Author: davsclaus
Date: Sat May 24 08:19:09 2008
New Revision: 659836

URL: http://svn.apache.org/viewvc?rev=659836&view=rev
Log:
CAMEL-517: Polished javadoc, and fixed a few IDEA hints and uses for each loop

Removed:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/Out.java
Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterLoader.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterRegistry.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java?rev=659836&r1=659835&r2=659836&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
 Sat May 24 08:19:09 2008
@@ -27,13 +27,14 @@
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.impl.ServiceSupport;
 import org.apache.camel.impl.converter.AsyncProcessorTypeConverter;
 import org.apache.camel.util.ServiceHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 /**
+ * Cache containing created [EMAIL PROTECTED] Producer}.
+ *
  * @version $Revision$
  */
 public class ProducerCache<E extends Exchange> extends ServiceSupport {
@@ -162,6 +163,7 @@
 
     protected void doStop() throws Exception {
         ServiceHelper.stopServices(producers.values());
+        producers.clear();
     }
 
     protected void doStart() throws Exception {

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterLoader.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterLoader.java?rev=659836&r1=659835&r2=659836&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterLoader.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterLoader.java
 Sat May 24 08:19:09 2008
@@ -27,6 +27,11 @@
 import org.apache.camel.impl.converter.TypeConverterRegistry;
 import org.apache.camel.util.ObjectHelper;
 
+/**
+ * Type converter loader that is capable of reporting the loaded type 
converters.
+ *
+ * @deprecated not used
+ */
 public class ReportingTypeConverterLoader extends 
AnnotationTypeConverterLoader {
 
     private static final Comparator<TypeMapping> COMPARE_LAST_LOADED_FIRST = 
new Comparator<TypeMapping>() {
@@ -59,14 +64,16 @@
 
     /**
      * Represents a mapping from one type (which can be null) to another
+     *
+     * @deprecated not used
      */
     public static class TypeMapping {
         private static int counter;
-        Class toType;
-        Class fromType;
-        Class converterType;
-        Method method;
-        int index;
+        private Class toType;
+        private Class fromType;
+        private Class converterType;
+        private Method method;
+        private int index;
 
         public TypeMapping(Class toType, Class fromType, Class converterType, 
Method method) {
             this.toType = toType;
@@ -119,4 +126,5 @@
             return "[" + fromType.getSimpleName() + "=>" + 
toType.getSimpleName() + "]";
         }
     }
+
 }

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterRegistry.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterRegistry.java?rev=659836&r1=659835&r2=659836&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterRegistry.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ReportingTypeConverterRegistry.java
 Sat May 24 08:19:09 2008
@@ -23,6 +23,11 @@
 import org.apache.camel.impl.converter.TypeConverterRegistry;
 import org.apache.camel.spi.Injector;
 
+/**
+ * Registry for reporting type converters.
+ *
+ * @deprecated not used
+ */
 public class ReportingTypeConverterRegistry implements TypeConverterRegistry {
     private List<String> errors = new ArrayList<String>();
 

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java?rev=659836&r1=659835&r2=659836&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
 Sat May 24 08:19:09 2008
@@ -19,9 +19,12 @@
 import java.io.IOException;
 
 /**
+ * IO helper class.
+ *
  * @version $Revision$
  */
 public final class IOHelper {
+
     private IOHelper() {
         //Utility Class
     }

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?rev=659836&r1=659835&r2=659836&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
 Sat May 24 08:19:09 2008
@@ -36,11 +36,13 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+/**
+ * Helper for introspections of beans.
+ */
 public final class IntrospectionSupport {
 
     private static final Log LOG = 
LogFactory.getLog(IntrospectionSupport.class);
 
-
     /**
      * Utility classes should not have a public constructor.
      */
@@ -61,14 +63,13 @@
 
         Class clazz = target.getClass();
         Method[] methods = clazz.getMethods();
-        for (int i = 0; i < methods.length; i++) {
-            Method method = methods[i];
+        for (Method method : methods) {
             String name = method.getName();
             Class type = method.getReturnType();
             Class params[] = method.getParameterTypes();
             if (name.startsWith("get") && params.length == 0 && type != null 
&& isSettableType(type)) {
                 try {
-                    Object value = method.invoke(target, new Object[] {});
+                    Object value = method.invoke(target);
                     if (value == null) {
                         continue;
                     }
@@ -101,11 +102,11 @@
 
         Class clazz = target.getClass();
         Method method = getPropertyGetter(clazz, prop);
-        return method.invoke(target, new Object[] {});
+        return method.invoke(target);
     }
 
     public static Method getPropertyGetter(Class type, String propertyName) 
throws NoSuchMethodException {
-        Method method = type.getMethod("get" + 
ObjectHelper.capitalize(propertyName), new Class[] {});
+        Method method = type.getMethod("get" + 
ObjectHelper.capitalize(propertyName));
         return method;
     }
 
@@ -188,11 +189,11 @@
             // If the type is null or it matches the needed type, just use the
             // value directly
             if (value == null || value.getClass() == 
setter.getParameterTypes()[0]) {
-                setter.invoke(target, new Object[] {value});
+                setter.invoke(target, value);
             } else {
                 // We need to convert it
                 Object convertedValue = convert(typeConverter, 
setter.getParameterTypes()[0], value);
-                setter.invoke(target, new Object[] {convertedValue});
+                setter.invoke(target, convertedValue);
             }
             return true;
         } catch (InvocationTargetException e) {
@@ -207,7 +208,6 @@
         }
     }
 
-
     public static boolean setProperty(Object target, String name, Object 
value) throws Exception {
         return setProperty(null, target, name, value);
     }
@@ -238,7 +238,7 @@
             return editor.getAsText();
         }
         if (type == URI.class) {
-            return ((URI)value).toString();
+            return value.toString();
         }
         return null;
     }
@@ -248,8 +248,7 @@
         name = "set" + ObjectHelper.capitalize(name);
         while (clazz != Object.class) {
             Method[] methods = clazz.getMethods();
-            for (int i = 0; i < methods.length; i++) {
-                Method method = methods[i];
+            for (Method method : methods) {
                 Class params[] = method.getParameterTypes();
                 if (method.getName().equals(name) && params.length == 1) {
                     Class paramType = params[0];
@@ -327,9 +326,9 @@
         }
 
         Field[] fields = startClass.getDeclaredFields();
-        for (int i = 0; i < fields.length; i++) {
-            Field field = fields[i];
-            if (Modifier.isStatic(field.getModifiers()) || 
Modifier.isTransient(field.getModifiers()) || 
Modifier.isPrivate(field.getModifiers())) {
+        for (Field field : fields) {
+            if (Modifier.isStatic(field.getModifiers()) || 
Modifier.isTransient(field.getModifiers())
+                || Modifier.isPrivate(field.getModifiers())) {
                 continue;
             }
 

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java?rev=659836&r1=659835&r2=659836&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java
 Sat May 24 08:19:09 2008
@@ -34,6 +34,9 @@
  */
 public class URISupport {
 
+    /**
+     * Holder to get parts of the URI.
+     */
     public static class CompositeData {
         public String host;
 
@@ -108,14 +111,14 @@
             Map rc = new HashMap();
             if (uri != null) {
                 String[] parameters = uri.split("&");
-                for (int i = 0; i < parameters.length; i++) {
-                    int p = parameters[i].indexOf("=");
+                for (String parameter : parameters) {
+                    int p = parameter.indexOf("=");
                     if (p >= 0) {
-                        String name = 
URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
-                        String value = 
URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
+                        String name = URLDecoder.decode(parameter.substring(0, 
p), "UTF-8");
+                        String value = URLDecoder.decode(parameter.substring(p 
+ 1), "UTF-8");
                         rc.put(name, value);
                     } else {
-                        rc.put(parameters[i], null);
+                        rc.put(parameter, null);
                     }
                 }
             }
@@ -288,8 +291,6 @@
 
     /**
      * Creates a URI from the original URI and the remaining parameters
-     * 
-     * @throws URISyntaxException
      */
     public static URI createRemainingURI(URI originalURI, Map params) throws 
URISyntaxException {
         String s = createQueryString(params);

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java?rev=659836&r1=659835&r2=659836&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
 Sat May 24 08:19:09 2008
@@ -22,9 +22,11 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-
+/**
+ * Encoder for unsafe URI characters.
+ */
 public final class UnsafeUriCharactersEncoder {
-    static BitSet unsafeCharacters;
+    private static BitSet unsafeCharacters;
     private static final transient Log LOG = 
LogFactory.getLog(UnsafeUriCharactersEncoder.class);
     private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', 
'6', '7', '8', '9', 'A', 'B', 'C',
                                               'D', 'E', 'F'};
@@ -48,7 +50,6 @@
         unsafeCharacters.set('`');
     }
 
-
     private UnsafeUriCharactersEncoder() {
         // util class
     }
@@ -59,9 +60,8 @@
             return s;
         }
 
-        // First check whether we actually need to encode
-
         try {
+            // First check whether we actually need to encode
             byte[] bytes = s.getBytes("UTF8");
             for (int i = 0;;) {
                 if (unsafeCharacters.get(bytes[i])) {
@@ -72,10 +72,11 @@
                 }
             }
 
+            // okay there are some unsafe characters so we do need to encode
             StringBuffer sb = new StringBuffer();
             for (byte b : bytes) {
                 if (unsafeCharacters.get(b)) {
-                    appendEscape(sb, (byte)b);
+                    appendEscape(sb, b);
                 } else {
                     sb.append((char)b);
                 }


Reply via email to