Author: davsclaus Date: Sat Jul 18 13:51:14 2009 New Revision: 795369 URL: http://svn.apache.org/viewvc?rev=795369&view=rev Log: Fixed some sonartype reported issues.
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java camel/trunk/camel-core/src/main/java/org/apache/camel/component/ref/RefComponent.java camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceFormatter.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Delayer.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaValidationException.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java Sat Jul 18 13:51:14 2009 @@ -24,7 +24,6 @@ import org.apache.camel.builder.xml.XPathBuilder; import org.apache.camel.language.LanguageAnnotation; import org.apache.camel.language.NamespacePrefix; -import org.apache.camel.language.XPath; import org.apache.camel.util.ObjectHelper; /** @@ -54,7 +53,7 @@ Object value = ObjectHelper.invokeMethod(method, annotation); return (NamespacePrefix[])value; } catch (NoSuchMethodException e) { - throw new IllegalArgumentException("Cannot determine the annotation: " + annotation + " as it does not have an namespaces() method"); + throw new IllegalArgumentException("Cannot determine the annotation: " + annotation + " as it does not have an namespaces() method", e); } } } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/ref/RefComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/ref/RefComponent.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/ref/RefComponent.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/ref/RefComponent.java Sat Jul 18 13:51:14 2009 @@ -30,7 +30,7 @@ protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { // lets remove the scheme from the URI - int index = uri.indexOf(":"); + int index = uri.indexOf(':'); String name = uri; if (index >= 0) { name = uri.substring(index + 1); Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaComponent.java Sat Jul 18 13:51:14 2009 @@ -60,7 +60,7 @@ protected String getQueueKey(String uri) { if (uri.contains("?")) { // strip parameters - uri = uri.substring(0, uri.indexOf("?")); + uri = uri.substring(0, uri.indexOf('?')); } return uri; } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java Sat Jul 18 13:51:14 2009 @@ -42,14 +42,12 @@ import java.io.UnsupportedEncodingException; import java.io.Writer; import java.net.URL; -import java.nio.CharBuffer; import javax.xml.transform.TransformerException; import javax.xml.transform.dom.DOMSource; import org.apache.camel.Converter; import org.apache.camel.Exchange; import org.apache.camel.converter.jaxp.XmlConverter; -import org.apache.camel.util.CollectionStringBuffer; import org.apache.camel.util.IOHelper; import org.apache.camel.util.ObjectHelper; import org.apache.commons.logging.Log; @@ -140,11 +138,10 @@ @Converter public static InputStream toInputStrean(DOMSource source) throws TransformerException, IOException { XmlConverter xmlConverter = createXmlConverter(); - ByteArrayInputStream bais = new ByteArrayInputStream(xmlConverter.toString(source).getBytes()); - return bais; + return new ByteArrayInputStream(xmlConverter.toString(source).getBytes()); } - private static XmlConverter createXmlConverter() { + private static synchronized XmlConverter createXmlConverter() { if (xmlConverter == null) { xmlConverter = new XmlConverter(); } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Sat Jul 18 13:51:14 2009 @@ -86,7 +86,7 @@ * * @version $Revision$ */ -public class DefaultCamelContext extends ServiceSupport implements CamelContext, Service { +public class DefaultCamelContext extends ServiceSupport implements CamelContext { private static final transient Log LOG = LogFactory.getLog(DefaultCamelContext.class); private static final String NAME_PREFIX = "camel-"; private static int nameSuffix; @@ -120,13 +120,14 @@ private FactoryFinder defaultFactoryFinder; private final Map<String, FactoryFinder> factories = new HashMap<String, FactoryFinder>(); private final Map<String, RouteService> routeServices = new HashMap<String, RouteService>(); - private ClassResolver classResolver; + private ClassResolver classResolver = new DefaultClassResolver(); private PackageScanClassResolver packageScanClassResolver; // we use a capacity of 100 per endpoint, so for the same endpoint we have at most 100 producers in the pool // so if we have 6 endpoints in the pool, we have 6 x 100 producers in total private ServicePool<Endpoint, Producer> producerServicePool = new DefaultProducerServicePool(100); public DefaultCamelContext() { + super(); name = NAME_PREFIX + ++nameSuffix; if (Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) { @@ -153,20 +154,14 @@ } } - if (classResolver == null) { - classResolver = new DefaultClassResolver(); + // use WebSphere specific resolver if running on WebSphere + if (WebSpherePacakageScanClassResolver.isWebSphereClassLoader(this.getClass().getClassLoader())) { + LOG.info("Using WebSphere specific PackageScanClassResolver"); + packageScanClassResolver = new WebSpherePacakageScanClassResolver("META-INF/services/org/apache/camel/TypeConverter"); + } else { + packageScanClassResolver = new DefaultPackageScanClassResolver(); } - if (packageScanClassResolver == null) { - // use WebSphere specific resolver if running on WebSphere - if (WebSpherePacakageScanClassResolver.isWebSphereClassLoader(this.getClass().getClassLoader())) { - LOG.info("Using WebSphere specific PackageScanClassResolver"); - packageScanClassResolver = new WebSpherePacakageScanClassResolver("META-INF/services/org/apache/camel/TypeConverter"); - } else { - packageScanClassResolver = new DefaultPackageScanClassResolver(); - } - - } } /** Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java Sat Jul 18 13:51:14 2009 @@ -96,7 +96,7 @@ if (isLenientProperties()) { // only use the endpoint uri without parameters as the properties is lenient String uri = getEndpointUri(); - if (uri.indexOf("?") != -1) { + if (uri.indexOf('?') != -1) { return ObjectHelper.before(uri, "?"); } else { return uri; Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguageSupport.java Sat Jul 18 13:51:14 2009 @@ -258,7 +258,7 @@ results.add(createConstantExpression(expression, pivot, idx)); } pivot = idx + 2; - int endIdx = expression.indexOf("}", pivot); + int endIdx = expression.indexOf('}', pivot); if (endIdx < 0) { throw new IllegalArgumentException("Expecting } but found end of string for simple expression: " + expression); } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceFormatter.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceFormatter.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceFormatter.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceFormatter.java Sat Jul 18 13:51:14 2009 @@ -263,7 +263,7 @@ id = getBreadCrumbID(exchange).toString(); if (showShortExchangeId) { // skip hostname for short exchange id - id = id.substring(id.indexOf("/") + 1); + id = id.substring(id.indexOf('/') + 1); } } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Delayer.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Delayer.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Delayer.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Delayer.java Sat Jul 18 13:51:14 2009 @@ -55,8 +55,7 @@ } public Processor wrapProcessorInInterceptors(ProcessorDefinition processorDefinition, Processor target, Processor nextTarget) throws Exception { - DelayInterceptor delayer = new DelayInterceptor(processorDefinition, target, this); - return delayer; + return new DelayInterceptor(processorDefinition, target, this); } public boolean isEnabled() { Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java Sat Jul 18 13:51:14 2009 @@ -302,17 +302,9 @@ if (tracer.isUseJpa()) { LOG.trace("Using class: " + JPA_TRACE_EVENT_MESSAGE + " for tracing event messages"); - // load the jpa event class - synchronized (this) { - if (jpaTraceEventMessageClass == null) { - jpaTraceEventMessageClass = exchange.getContext().getClassResolver().resolveClass(JPA_TRACE_EVENT_MESSAGE); - if (jpaTraceEventMessageClass == null) { - throw new IllegalArgumentException("Cannot find class: " + JPA_TRACE_EVENT_MESSAGE - + ". Make sure camel-jpa.jar is in the classpath."); - } - } - } - + // load the jpa event message class + loadJpaTraceEventMessageClass(exchange); + // create a new instance of the event message class Object jpa = ObjectHelper.newInstance(jpaTraceEventMessageClass); // copy options from event to jpa @@ -341,6 +333,16 @@ } } + private synchronized void loadJpaTraceEventMessageClass(Exchange exchange) { + if (jpaTraceEventMessageClass == null) { + jpaTraceEventMessageClass = exchange.getContext().getClassResolver().resolveClass(JPA_TRACE_EVENT_MESSAGE); + if (jpaTraceEventMessageClass == null) { + throw new IllegalArgumentException("Cannot find class: " + JPA_TRACE_EVENT_MESSAGE + + ". Make sure camel-jpa.jar is in the classpath."); + } + } + } + protected void logException(Exchange exchange, Throwable throwable) { if (tracer.isTraceExceptions()) { if (tracer.isLogStackTrace()) { Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java Sat Jul 18 13:51:14 2009 @@ -39,6 +39,7 @@ private final Map<Object, Processor> stickyMap = new HashMap<Object, Processor>(); public StickyLoadBalancer() { + super(); this.loadBalancer = new RoundRobinLoadBalancer(); } @@ -47,18 +48,11 @@ } public StickyLoadBalancer(Expression correlationExpression, QueueLoadBalancer loadBalancer) { + super(); this.correlationExpression = correlationExpression; this.loadBalancer = loadBalancer; } - public void setCorrelationExpression(Expression correlationExpression) { - this.correlationExpression = correlationExpression; - } - - public void setLoadBalancer(QueueLoadBalancer loadBalancer) { - this.loadBalancer = loadBalancer; - } - protected synchronized Processor chooseProcessor(List<Processor> processors, Exchange exchange) { Object value = correlationExpression.evaluate(exchange, Object.class); Object key = getStickyKey(value); Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaValidationException.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaValidationException.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaValidationException.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaValidationException.java Sat Jul 18 13:51:14 2009 @@ -73,7 +73,9 @@ protected static String message(Object schema, List<SAXParseException> fatalErrors, List<SAXParseException> errors, List<SAXParseException> warnings) { - StringBuffer buffer = new StringBuffer("Validation failed for: " + schema); + StringBuffer buffer = new StringBuffer("Validation failed for: "); + buffer.append(schema); + if (!fatalErrors.isEmpty()) { buffer.append(" fatal errors: "); buffer.append(fatalErrors); @@ -82,6 +84,7 @@ buffer.append(" errors: "); buffer.append(errors); } + return buffer.toString(); } } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java Sat Jul 18 13:51:14 2009 @@ -162,13 +162,15 @@ * @param parameters parameters * @throws Exception is thrown if setting property fails */ + @SuppressWarnings("unchecked") public static void setReferenceProperties(CamelContext context, Object bean, Map parameters) throws Exception { - Iterator it = parameters.keySet().iterator(); + Iterator<Map.Entry> it = parameters.entrySet().iterator(); while (it.hasNext()) { - Object key = it.next(); - Object v = parameters.get(key); + Map.Entry entry = it.next(); + Object key = entry.getKey(); + Object v = entry.getValue(); String value = v != null ? v.toString() : null; - if (isReferenceParameter(value)) { + if (value != null && isReferenceParameter(value)) { Object ref = context.getRegistry().lookup(value.substring(1)); String name = key.toString(); if (ref != null) { Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java Sat Jul 18 13:51:14 2009 @@ -16,20 +16,11 @@ */ package org.apache.camel.util; -import java.io.BufferedReader; import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; import java.util.Iterator; -import java.util.List; import java.util.Locale; import java.util.Stack; -import java.util.regex.Matcher; -import java.util.regex.Pattern; /** * File utilities @@ -47,7 +38,7 @@ */ public static String normalizePath(String path) { // special handling for Windows where we need to convert / to \\ - if (path != null && System.getProperty("os.name").startsWith("Windows") && path.indexOf("/") >= 0) { + if (path != null && System.getProperty("os.name").startsWith("Windows") && path.indexOf('/') >= 0) { return path.replace('/', '\\'); } return path; @@ -201,114 +192,6 @@ } return result; } - - public static String getStringFromFile(File location) { - InputStream is = null; - String result = null; - - try { - is = new FileInputStream(location); - result = normalizeCRLF(is); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (is != null) { - try { - is.close(); - } catch (Exception e) { - //do nothing - } - } - } - - return result; - } - - public static String normalizeCRLF(InputStream instream) { - BufferedReader in = new BufferedReader(new InputStreamReader(instream)); - StringBuffer result = new StringBuffer(); - String line = null; - - try { - line = in.readLine(); - while (line != null) { - String[] tok = line.split("\\s"); - - for (int x = 0; x < tok.length; x++) { - String token = tok[x]; - result.append(" " + token); - } - line = in.readLine(); - } - } catch (Exception ex) { - ex.printStackTrace(); - } - - String rtn = result.toString(); - - rtn = ignoreTokens(rtn, "<!--", "-->"); - rtn = ignoreTokens(rtn, "/*", "*/"); - return rtn; - } - - private static String ignoreTokens(final String contents, - final String startToken, final String endToken) { - String rtn = contents; - int headerIndexStart = rtn.indexOf(startToken); - int headerIndexEnd = rtn.indexOf(endToken); - if (headerIndexStart != -1 && headerIndexEnd != -1 && headerIndexStart < headerIndexEnd) { - rtn = rtn.substring(0, headerIndexStart - 1) - + rtn.substring(headerIndexEnd + endToken.length() + 1); - } - return rtn; - } - - public static List<File> getFiles(File dir, final String pattern) { - return getFiles(dir, pattern, null); - } - public static List<File> getFilesRecurse(File dir, final String pattern) { - return getFilesRecurse(dir, pattern, null); - } - - public static List<File> getFiles(File dir, final String pattern, File exclude) { - return getFilesRecurse(dir, Pattern.compile(pattern), exclude, false, new ArrayList<File>()); - } - public static List<File> getFilesRecurse(File dir, final String pattern, File exclude) { - return getFilesRecurse(dir, Pattern.compile(pattern), exclude, true, new ArrayList<File>()); - } - private static List<File> getFilesRecurse(File dir, - Pattern pattern, - File exclude, boolean rec, - List<File> fileList) { - for (File file : dir.listFiles()) { - if (file.equals(exclude)) { - continue; - } - if (file.isDirectory() && rec) { - getFilesRecurse(file, pattern, exclude, rec, fileList); - } else { - Matcher m = pattern.matcher(file.getName()); - if (m.matches()) { - fileList.add(file); - } - } - } - return fileList; - } - - public static List<String> readLines(File file) throws Exception { - if (!file.exists()) { - return new ArrayList<String>(); - } - BufferedReader reader = new BufferedReader(new FileReader(file)); - List<String> results = new ArrayList<String>(); - String line = reader.readLine(); - while (line != null) { - results.add(line); - line = reader.readLine(); - } - return results; - } /** * Strip any leading separators @@ -343,7 +226,7 @@ if (name == null) { return null; } - int pos = name.lastIndexOf("/"); + int pos = name.lastIndexOf('/'); if (pos == -1) { pos = name.lastIndexOf(File.separator); } @@ -360,7 +243,7 @@ if (name == null) { return null; } - int pos = name.lastIndexOf("/"); + int pos = name.lastIndexOf('/'); if (pos == -1) { pos = name.lastIndexOf(File.separator); } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java Sat Jul 18 13:51:14 2009 @@ -141,22 +141,25 @@ return type.getMethod("get" + ObjectHelper.capitalize(propertyName)); } + @SuppressWarnings("unchecked") public static boolean setProperties(Object target, Map properties, String optionPrefix) throws Exception { ObjectHelper.notNull(target, "target"); ObjectHelper.notNull(properties, "properties"); boolean rc = false; - for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) { - String name = (String)iter.next(); + for (Iterator<Map.Entry> it = properties.entrySet().iterator(); it.hasNext();) { + Map.Entry entry = it.next(); + String name = entry.getKey().toString(); if (name.startsWith(optionPrefix)) { Object value = properties.get(name); name = name.substring(optionPrefix.length()); if (setProperty(target, name, value)) { - iter.remove(); + it.remove(); rc = true; } } } + return rc; } @@ -166,13 +169,14 @@ HashMap rc = new LinkedHashMap(properties.size()); - for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) { - String name = (String)iter.next(); + for (Iterator<Map.Entry> it = properties.entrySet().iterator(); it.hasNext();) { + Map.Entry entry = it.next(); + String name = entry.getKey().toString(); if (name.startsWith(optionPrefix)) { Object value = properties.get(name); name = name.substring(optionPrefix.length()); rc.put(name, value); - iter.remove(); + it.remove(); } } @@ -387,7 +391,7 @@ public static String simpleName(Class clazz) { String name = clazz.getName(); - int p = name.lastIndexOf("."); + int p = name.lastIndexOf('.'); if (p >= 0) { name = name.substring(p + 1); } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java Sat Jul 18 13:51:14 2009 @@ -33,7 +33,9 @@ * @version $Revision$ */ public final class URISupport { - + + private static final String CHARSET = "UTF-8"; + private URISupport() { // Helper class } @@ -120,8 +122,8 @@ for (String parameter : parameters) { int p = parameter.indexOf("="); if (p >= 0) { - String name = URLDecoder.decode(parameter.substring(0, p), "UTF-8"); - String value = URLDecoder.decode(parameter.substring(p + 1), "UTF-8"); + String name = URLDecoder.decode(parameter.substring(0, p), CHARSET); + String value = URLDecoder.decode(parameter.substring(p + 1), CHARSET); rc.put(name, value); } else { rc.put(parameter, null); @@ -188,7 +190,7 @@ } int p; - int intialParen = ssp.indexOf("("); + int intialParen = ssp.indexOf('('); if (intialParen == 0) { rc.host = ssp.substring(0, intialParen); p = rc.host.indexOf("/"); @@ -196,7 +198,7 @@ rc.path = rc.host.substring(p); rc.host = rc.host.substring(0, p); } - p = ssp.lastIndexOf(")"); + p = ssp.lastIndexOf(')'); componentString = ssp.substring(intialParen + 1, p); params = ssp.substring(p + 1).trim(); } else { @@ -210,7 +212,7 @@ rc.components[i] = new URI(components[i].trim()); } - p = params.indexOf("?"); + p = params.indexOf('?'); if (p >= 0) { if (p > 0) { rc.path = stripPrefix(params.substring(0, p), "/"); @@ -285,11 +287,11 @@ String key = (String) o; String value = (String) options.get(key); - rc.append(URLEncoder.encode(key, "UTF-8")); + rc.append(URLEncoder.encode(key, CHARSET)); // only append if value is not null if (value != null) { rc.append("="); - rc.append(URLEncoder.encode(value, "UTF-8")); + rc.append(URLEncoder.encode(value, CHARSET)); } } return rc.toString(); Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java Sat Jul 18 13:51:14 2009 @@ -63,15 +63,13 @@ public long getDelay(TimeUnit unit) { // if the answer is 0 then this task is ready to be taken - long answer = id - index.get(); - return answer; + return id - index.get(); } @SuppressWarnings("unchecked") public int compareTo(Delayed o) { SubmitOrderFutureTask other = (SubmitOrderFutureTask) o; - int answer = (int) (this.id - other.id); - return answer; + return (int) (this.id - other.id); } @Override Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java?rev=795369&r1=795368&r2=795369&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java Sat Jul 18 13:51:14 2009 @@ -169,7 +169,7 @@ } protected String removeQueryString(String text) { - int idx = text.indexOf("?"); + int idx = text.indexOf('?'); if (idx <= 0) { return text; } else {