ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r558071 - /ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java
Date Fri, 20 Jul 2007 17:49:23 GMT
Author: peterreilly
Date: Fri Jul 20 10:49:22 2007
New Revision: 558071

URL: http://svn.apache.org/viewvc?view=rev&rev=558071
Log:
checkstyle changes

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java?view=diff&rev=558071&r1=558070&r2=558071
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java Fri Jul 20 10:49:22
2007
@@ -71,10 +71,10 @@
 
     // Set up PRIMITIVE_TYPE_MAP
     static {
-        Class[] primitives = { Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE,
-                               Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE };
-        Class[] wrappers = { Boolean.class, Byte.class, Character.class, Short.class,
-                             Integer.class, Long.class, Float.class, Double.class };
+        Class[] primitives = {Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE,
+                              Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE};
+        Class[] wrappers = {Boolean.class, Byte.class, Character.class, Short.class,
+                            Integer.class, Long.class, Float.class, Double.class};
         for (int i = 0; i < primitives.length; i++) {
             PRIMITIVE_TYPE_MAP.put (primitives[i], wrappers[i]);
         }
@@ -948,7 +948,7 @@
             return new AttributeSetter(m, arg) {
                 public void set(Project p, Object parent, String value)
                         throws InvocationTargetException, IllegalAccessException {
-                    m.invoke(parent, (Object[]) new String[] { value });
+                    m.invoke(parent, (Object[]) new String[] {value});
                 }
             };
         }
@@ -961,7 +961,7 @@
                         throw new BuildException("The value \"\" is not a "
                                 + "legal value for attribute \"" + attrName + "\"");
                     }
-                    m.invoke(parent, (Object[]) new Character[] { new Character(value.charAt(0))
});
+                    m.invoke(parent, (Object[]) new Character[] {new Character(value.charAt(0))});
                 }
             };
         }
@@ -981,7 +981,7 @@
                 public void set(Project p, Object parent, String value)
                         throws InvocationTargetException, IllegalAccessException, BuildException
{
                     try {
-                        m.invoke(parent, new Object[] { Class.forName(value) });
+                        m.invoke(parent, new Object[] {Class.forName(value)});
                     } catch (ClassNotFoundException ce) {
                         throw new BuildException(ce);
                     }
@@ -993,7 +993,7 @@
             return new AttributeSetter(m, arg) {
                 public void set(Project p, Object parent, String value)
                         throws InvocationTargetException, IllegalAccessException {
-                    m.invoke(parent, new Object[] { p.resolveFile(value) });
+                    m.invoke(parent, new Object[] {p.resolveFile(value)});
                 }
             };
         }
@@ -1005,7 +1005,7 @@
                     try {
                         EnumeratedAttribute ea = (EnumeratedAttribute) reflectedArg.newInstance();
                         ea.setValue(value);
-                        m.invoke(parent, new Object[] { ea });
+                        m.invoke(parent, new Object[] {ea});
                     } catch (InstantiationException ie) {
                         throw new BuildException(ie);
                     }
@@ -1128,7 +1128,7 @@
      *
      * @return the lower-cased method name with the prefix removed.
      */
-    private String getPropertyName(String methodName, String prefix) {
+    private static String getPropertyName(String methodName, String prefix) {
         return methodName.substring(prefix.length()).toLowerCase(Locale.US);
     }
 
@@ -1342,13 +1342,15 @@
                 Class useType = type;
                 if (type.isPrimitive()) {
                     if (value == null) {
-                        throw new BuildException("Attempt to set primitive "
-                                + method.getName().substring(4) + " to null on " + parent);
+                        throw new BuildException(
+                            "Attempt to set primitive "
+                            + getPropertyName(method.getName(), "set")
+                            + " to null on " + parent);
                     }
                     useType = (Class) PRIMITIVE_TYPE_MAP.get(type);
                 }
                 if (value == null || useType.isInstance(value)) {
-                    method.invoke(parent, new Object[] { value });
+                    method.invoke(parent, new Object[] {value});
                     return;
                 }
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message