harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhouke...@apache.org
Subject svn commit: r952132 [1/2] - in /harmony/enhanced/java/trunk/classlib/modules/beans/src: main/java/java/beans/ main/java/org/apache/harmony/beans/ main/java/org/apache/harmony/beans/editors/ test/java/org/apache/harmony/beans/tests/java/beans/
Date Mon, 07 Jun 2010 08:06:19 GMT
Author: zhoukevin
Date: Mon Jun  7 08:06:18 2010
New Revision: 952132

URL: http://svn.apache.org/viewvc?rev=952132&view=rev
Log:
Refine the source and test of BEANS module (no functional changes):
1. Improve logicality and readability of methods
2. Format some bad-formatting code
3. Move one common method into BeansUtils class
4. Add some test cases

Modified:
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/BeanDescriptor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Beans.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ClassPersistenceDelegate.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/CustomizedObjectInputStream.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventHandler.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/FeatureDescriptor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/PropertyEditorManager.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ProxyPersistenceDelegate.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ReferenceMap.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Statement.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLDecoder.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Argument.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/BeansUtils.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Command.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/BooleanEditor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ByteEditor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FloatEditor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FontEditor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/IntEditor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/LongEditor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ShortEditor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
    harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/BeanDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/BeanDescriptor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/BeanDescriptor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/BeanDescriptor.java Mon Jun  7 08:06:18 2010
@@ -39,7 +39,6 @@ public class BeanDescriptor extends Feat
      *            The bean's customizer Class.
      */
     public BeanDescriptor(Class<?> beanClass, Class<?> customizerClass) {
-        super();
         if (beanClass == null) {
             throw new NullPointerException();
         }
@@ -59,13 +58,7 @@ public class BeanDescriptor extends Feat
      *            The bean's Class.
      */
     public BeanDescriptor(Class<?> beanClass) {
-        super();
-
-        if (beanClass == null) {
-            throw new NullPointerException();
-        }
-        setName(getShortClassName(beanClass));
-        this.beanClass = beanClass;
+        this(beanClass, null);
     }
 
     /**
@@ -100,17 +93,12 @@ public class BeanDescriptor extends Feat
      * @return A String instance or <code>null</code>.
      */
     private String getShortClassName(Class<?> leguminaClass) {
-        String result = null;
-
-        if (leguminaClass != null) {
-            String beanClassName = leguminaClass.getName();
-            int idx = beanClassName.lastIndexOf('.');
-
-            result = (idx == -1) ? beanClassName : beanClassName
-                    .substring(idx + 1);
+        if(leguminaClass == null) {
+            return null;
         }
-
-        return result;
+        String beanClassName = leguminaClass.getName();
+        int lastIndex = beanClassName.lastIndexOf("."); //$NON-NLS-1$
+        return (lastIndex == -1) ? beanClassName : beanClassName.substring(lastIndex + 1);
     }
 
 }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Beans.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Beans.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Beans.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Beans.java Mon Jun  7 08:06:18 2010
@@ -57,40 +57,36 @@ public class Beans {
 
     @SuppressWarnings("unchecked")
     private static Object internalInstantiate(ClassLoader cls, String beanName,
-            BeanContext context, Object initializer)
-            throws IOException, ClassNotFoundException {
-        Object result = null;
-
-        boolean deserialized = true;
-
-        ClassLoader loader = null;
-
+            BeanContext context, Object initializer) throws IOException,
+            ClassNotFoundException {
         // First try to load it from a serialization file.
         String beanResourceName = getBeanResourceName(beanName);
-
         InputStream is = (cls == null) ? ClassLoader
                 .getSystemResourceAsStream(beanResourceName) : cls
                 .getResourceAsStream(beanResourceName);
 
         IOException serializationException = null;
+        Object result = null;
         if (is != null) {
-            try{
-                ObjectInputStream ois = (cls == null) ? new ObjectInputStream(is)
-                        : new CustomizedObjectInputStream(is, cls);
+            try {
+                ObjectInputStream ois = (cls == null) ? new ObjectInputStream(
+                        is) : new CustomizedObjectInputStream(is, cls);
                 result = ois.readObject();
-            }catch(IOException exception){
-                //Not loadable - remember this as we may throw it later.
-                serializationException = exception;
+            } catch (IOException e) {
+                // Not loadable - remember this as we may throw it later.
+                serializationException = e;
             }
         }
 
-        //If that did not work, try to instantiate it from the given classloader.
+        // If it didn't work, try to instantiate it from the given classloader
+        boolean deserialized = true;
+        ClassLoader classLoader = cls == null ? ClassLoader
+                .getSystemClassLoader() : cls;
         if (result == null) {
             deserialized = false;
             try {
-                loader = cls == null ? ClassLoader.getSystemClassLoader() : cls;
-                Class<?> c = Class.forName(beanName, true, loader);
-                result = c.newInstance();
+                result = Class.forName(beanName, true, classLoader)
+                        .newInstance();
             } catch (Exception e) {
                 if (serializationException != null) {
                     throw serializationException;
@@ -108,10 +104,10 @@ public class Beans {
             } catch (Throwable t) {
                 // Ignored - leave isApplet as false.
             }
-            
+
             if (isApplet) {
-                appletLoaded((Applet) result, loader, beanName, context,
-                        (AppletInitializer)initializer, deserialized);
+                appletLoaded((Applet) result, classLoader, beanName, context,
+                        (AppletInitializer) initializer, deserialized);
             }
             if (null != context) {
                 context.add(result);
@@ -216,7 +212,6 @@ public class Beans {
      * @throws IOException
      * @throws ClassNotFoundException
      */
-    @SuppressWarnings("unchecked")
 	public static Object instantiate(ClassLoader cls, String beanName,
 			BeanContext context, AppletInitializer initializer)
 			throws IOException, ClassNotFoundException {
@@ -237,7 +232,6 @@ public class Beans {
      *            the specified view type.
      * @return a type view of the given bean.
      */
-    @SuppressWarnings("unused")
     public static Object getInstanceOf(Object bean, Class<?> targetType) {
         return bean;
     }
@@ -355,8 +349,9 @@ public class Beans {
         URL objectUrl = AccessController
                 .doPrivileged(new PrivilegedAction<URL>() {
                     public URL run() {
-                        if (loader == null)
+                        if (loader == null) {
                             return ClassLoader.getSystemResource(resourceName);
+                        }
                         return loader.getResource(resourceName);
                     }
                 });

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ClassPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ClassPersistenceDelegate.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ClassPersistenceDelegate.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ClassPersistenceDelegate.java Mon Jun  7 08:06:18 2010
@@ -22,7 +22,7 @@ import java.lang.reflect.Field;
 class ClassPersistenceDelegate extends PersistenceDelegate {
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
-        Class<?> value = (Class) oldInstance;
+        Class<?> value = (Class<?>) oldInstance;
         Field fld = null;
         final String TYPE = "TYPE"; //$NON-NLS-1$
         Expression result;
@@ -79,9 +79,9 @@ class ClassPersistenceDelegate extends P
 
     @Override
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
-        if (oldInstance instanceof Class && newInstance instanceof Class) {
-            Class<?> c1 = (Class) oldInstance;
-            Class<?> c2 = (Class) newInstance;
+        if (oldInstance instanceof Class<?> && newInstance instanceof Class<?>) {
+            Class<?> c1 = (Class<?>) oldInstance;
+            Class<?> c2 = (Class<?>) newInstance;
             if (c1.getName().equals(c2.getName())) {
                 return true;
             }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/CustomizedObjectInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/CustomizedObjectInputStream.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/CustomizedObjectInputStream.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/CustomizedObjectInputStream.java Mon Jun  7 08:06:18 2010
@@ -48,14 +48,12 @@ class CustomizedObjectInputStream extend
             int idx = className.lastIndexOf("["); //$NON-NLS-1$
             String prefix = className.substring(0, idx + 1);
             int[] dimensions = new int[prefix.length()];
-            String postfix;
-            Class<?> componentType = null;
-
             for (int i = 0; i < dimensions.length; ++i) {
                 dimensions[i] = 0;
             }
 
-            postfix = className.substring(idx + 1);
+            String postfix = className.substring(idx + 1);
+            Class<?> componentType = null;
             if (postfix.equals("Z")) { //$NON-NLS-1$
                 componentType = boolean.class;
             } else if (postfix.equals("B")) { //$NON-NLS-1$
@@ -81,10 +79,8 @@ class CustomizedObjectInputStream extend
                 throw new IllegalArgumentException(Messages.getString(
                         "beans.1E", className)); //$NON-NLS-1$
             }
-
             return Array.newInstance(componentType, dimensions).getClass();
         }
-        
         return Class.forName(className, true, cls);
     }
 }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Encoder.java Mon Jun  7 08:06:18 2010
@@ -67,7 +67,7 @@ import javax.swing.ToolTipManager;
 @SuppressWarnings("unchecked")
 public class Encoder {
 
-    private static final Hashtable delegates = new Hashtable();
+    private static final Hashtable<Class<?>, PersistenceDelegate> delegates = new Hashtable<Class<?>, PersistenceDelegate>();
 
     private static final DefaultPersistenceDelegate defaultPD = new DefaultPersistenceDelegate();
 
@@ -217,8 +217,7 @@ public class Encoder {
         }
 
         // registered delegate
-        PersistenceDelegate registeredPD = (PersistenceDelegate) delegates
-                .get(type);
+        PersistenceDelegate registeredPD = delegates.get(type);
         if (registeredPD != null) {
             return registeredPD;
         }
@@ -238,22 +237,23 @@ public class Encoder {
         if (type.isArray()) {
             return arrayPD;
         }
+
         if (Proxy.isProxyClass(type)) {
             return proxyPD;
         }
 
         // check "persistenceDelegate" property
         try {
-            BeanInfo binfo = Introspector.getBeanInfo(type);
-            if (binfo != null) {
-                PersistenceDelegate pd = (PersistenceDelegate) binfo
+            BeanInfo beanInfo = Introspector.getBeanInfo(type);
+            if (beanInfo != null) {
+                PersistenceDelegate pd = (PersistenceDelegate) beanInfo
                         .getBeanDescriptor().getValue("persistenceDelegate"); //$NON-NLS-1$
                 if (pd != null) {
                     return pd;
                 }
             }
         } catch (Exception e) {
-            // ignore
+            // Ignored
         }
 
         // default persistence delegate
@@ -283,11 +283,7 @@ public class Encoder {
      *            the exception listener to set
      */
     public void setExceptionListener(ExceptionListener listener) {
-        if (listener == null) {
-            this.listener = defaultExListener;
-            return;
-        }
-        this.listener = listener;
+        this.listener = listener == null ? defaultExListener : listener;
     }
 
     /**
@@ -316,7 +312,7 @@ public class Encoder {
         return get(old);
     }
 
-    private Object[] forceNewArray(Object oldArray[]) {
+    private Object[] forceNewArray(Object[] oldArray) {
         if (oldArray == null) {
             return null;
         }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventHandler.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventHandler.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventHandler.java Mon Jun  7 08:06:18 2010
@@ -26,6 +26,7 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.StringTokenizer;
 
+import org.apache.harmony.beans.BeansUtils;
 import org.apache.harmony.beans.internal.nls.Messages;
 
 public class EventHandler implements InvocationHandler {
@@ -61,17 +62,10 @@ public class EventHandler implements Inv
     }
 
     private Object invokeImpl(Object proxy, Method method, Object[] arguments) {
-        Class<?> proxyClass;
+        Class<?> proxyClass = proxy.getClass();
+        Object[] theArguments = arguments == null ? new Object[0] : arguments;
         Object result = null;
 
-        Object[] theArguments = arguments;
-        // XXX
-        if (arguments == null) {
-            theArguments = new Object[0];
-        }
-
-        proxyClass = proxy.getClass();
-
         // if a proxy
         if (Proxy.isProxyClass(proxyClass)) {
             InvocationHandler handler = Proxy.getInvocationHandler(proxy);
@@ -79,18 +73,20 @@ public class EventHandler implements Inv
             // if a valid object
             if (handler instanceof EventHandler) {
                 // if the method from the Object class is called
-                if (method.getDeclaringClass().equals(Object.class)) {
-                    if (method.getName().equals("hashCode") && //$NON-NLS-1$
-                            theArguments.length == 0) {
-                        result = Integer.valueOf(hashCode());
-                    } else if (method.getName().equals("equals") && //$NON-NLS-1$
-                            theArguments.length == 1 && theArguments[0] != null) {
+                String methodName = method.getName();
+                if (method.getDeclaringClass() == Object.class) {
+                    if (theArguments.length == 0) {
+                        if ("hashCode".equals(methodName)) { //$NON-NLS-1$
+                            result = Integer.valueOf(hashCode());
+                        } else if ("toString".equals(methodName)) { //$NON-NLS-1$
+                            result = proxy.getClass().getSimpleName()
+                                    + toString().substring(
+                                            getClass().getName().length());
+                        }
+                    } else if (theArguments.length == 1
+                            && theArguments[0] != null
+                            && "equals".equals(methodName)) { //$NON-NLS-1$
                         result = Boolean.valueOf(proxy == theArguments[0]);
-                    } else if (method.getName().equals("toString") && //$NON-NLS-1$
-                            theArguments.length == 0) {
-                        result = proxy.getClass().getSimpleName()
-                                + toString().substring(
-                                        getClass().getName().length());
                     }
                 } else if (isValidInvocation(method, theArguments)) {
                     // if listener method
@@ -109,7 +105,7 @@ public class EventHandler implements Inv
                     }
                 } else {
                     // in order to be compatible with RI
-                    if (listenerMethodName.equals(method.getName())) {
+                    if (listenerMethodName.equals(methodName)) {
                         throw new IllegalArgumentException(Messages
                                 .getString("beans.4D")); //$NON-NLS-1$
                     }
@@ -121,7 +117,6 @@ public class EventHandler implements Inv
                 throw new NullPointerException(Messages.getString("beans.55")); //$NON-NLS-1$
             }
         }
-
         return result;
     }
 
@@ -152,48 +147,42 @@ public class EventHandler implements Inv
                         action, eventPropertyName, listenerMethodName));
     }
 
-    @SuppressWarnings("unchecked")
     public static <T> T create(Class<T> listenerInterface, Object target,
             String action, String eventPropertyName) {
         return create(listenerInterface, target, action, eventPropertyName,
                 null);
     }
 
-    @SuppressWarnings("unchecked")
     public static <T> T create(Class<T> listenerInterface, Object target,
             String action) {
         return create(listenerInterface, target, action, null, null);
     }
 
     private boolean isValidInvocation(Method method, Object[] arguments) {
-        boolean result = false;
+        // all listener methods are valid
+        if (listenerMethodName == null) {
+            return true;
+        }
 
-        if (listenerMethodName == null) { // all listener methods are valid
-            result = true;
-        } else if (listenerMethodName.equals(method.getName())) {
-            // method's name matches
+        // method's name matches
+        if (listenerMethodName.equals(method.getName())) {
             // no arguments in call are valid
             if (eventPropertyName == null
                     && (arguments == null || arguments.length == 0)) {
-                result = true;
-                // one-argument call is also valid
-            } else if (arguments != null && arguments.length == 1) {
-                result = true;
-            } else {
-                result = false;
+                return true;
+            }
+            // one-argument call is also valid
+            if (arguments != null && arguments.length == 1) {
+                return true;
             }
-        } else {
-            result = false;
         }
-
-        return result;
+        return false;
     }
 
     private Object[] getArgs(Object[] arguments) throws Exception {
         if (eventPropertyName == null) {
-            return new Object[] {};
+            return new Object[0];
         } else if ((arguments == null) || (arguments.length == 0)) {
-            // || (arguments[0] == null)) {
             return arguments;
         } else {
             Object arg = arguments[0];
@@ -204,21 +193,21 @@ public class EventHandler implements Inv
                 PropertyDescriptor pd = findPropertyDescriptor(arg.getClass(),
                         propertyName);
 
+                Method getMethod = null;
                 if (pd != null) {
-                    Method getter = pd.getReadMethod();
+                    getMethod = pd.getReadMethod();
 
-                    if (getter != null) {
-                        arg = getter.invoke(arg, new Object[] {});
+                    if (getMethod != null) {
+                        arg = getMethod.invoke(arg, new Object[] {});
                     } else {
                         throw new IntrospectionException(Messages.getString(
                                 "beans.11", propertyName)); //$NON-NLS-1$
                     }
                 } else {
-                    Method method = findStaticGetter(arg.getClass(),
-                            propertyName);
+                    getMethod = findStaticGetter(arg.getClass(), propertyName);
 
-                    if (method != null) {
-                        arg = method.invoke(null, new Object[] {});
+                    if (getMethod != null) {
+                        arg = getMethod.invoke(null, new Object[] {});
                     } else {
                         // cannot access property getter
                         // RI throws NPE here so we should do the same
@@ -233,19 +222,14 @@ public class EventHandler implements Inv
 
     private Method getMethod(Object proxy, Method method, Object[] arguments,
             Object[] args) throws Exception {
-        Method result = null;
-
         // filtering - examine if the 'method' could be applied to proxy
-
         boolean found = false;
 
-        // can be invoke with any listener method
         if (listenerMethodName == null) {
+            // can be invoke with any listener method
             Class<?>[] proxyInterfaces = proxy.getClass().getInterfaces();
-
             for (Class<?> proxyInstance : proxyInterfaces) {
                 Method[] interfaceMethods = proxyInstance.getMethods();
-
                 for (Method listenerMethod : interfaceMethods) {
                     if (equalNames(listenerMethod, method)
                             && canInvokeWithArguments(listenerMethod, arguments)) {
@@ -258,9 +242,8 @@ public class EventHandler implements Inv
                     break;
                 }
             }
-
+        } else if (listenerMethodName.equals(method.getName())) {
             // can be invoked with a specified listener method
-        } else if (method.getName().equals(listenerMethodName)) {
             found = true;
         }
 
@@ -270,7 +253,7 @@ public class EventHandler implements Inv
 
         // 'Method' can be applied to proxy - filtering succeeded
         try {
-            result = findMethod(target.getClass(), args);
+            Method result = findMethod(target.getClass(), args);
             if (result == null) {
                 PropertyDescriptor pd = findPropertyDescriptor(target
                         .getClass(), action);
@@ -286,40 +269,33 @@ public class EventHandler implements Inv
                     throw new IndexOutOfBoundsException(Messages
                             .getString("beans.14")); //$NON-NLS-1$
                 }
-            } else {
-                return result;
             }
+            return result;
         } catch (IntrospectionException ie) {
             throw new IndexOutOfBoundsException(Messages.getString("beans.14")); //$NON-NLS-1$
         }
-
-        return result;
     }
 
     private PropertyDescriptor findPropertyDescriptor(Class<?> theClass,
             String propertyName) throws IntrospectionException {
-        PropertyDescriptor result = null;
         BeanInfo beanInfo = Introspector.getBeanInfo(theClass);
         PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
 
-        for (PropertyDescriptor element : pds) {
-            if (element.getName().equals(propertyName)) {
-                result = element;
-                break;
+        for (PropertyDescriptor pd : pds) {
+            if (pd.getName().equals(propertyName)) {
+                return pd;
             }
         }
-        return result;
+        return null;
     }
 
     private Method findStaticGetter(Class<?> theClass, String propertyName) {
-        Method result = null;
         Method[] methods = theClass.getMethods();
-
-        for (Method element : methods) {
-            int modifiers = element.getModifiers();
+        for (Method method : methods) {
+            int modifiers = method.getModifiers();
 
             if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
-                String methodName = element.getName();
+                String methodName = method.getName();
                 String postfix = null;
 
                 if (methodName.startsWith("get")) { //$NON-NLS-1$
@@ -330,67 +306,51 @@ public class EventHandler implements Inv
                     continue;
                 }
 
-                if ((element.getParameterTypes().length != 0)
-                        || (element.getReturnType() == void.class)) {
+                if ((method.getParameterTypes().length != 0)
+                        || (method.getReturnType() == void.class)) {
                     continue;
                 }
 
                 postfix = Introspector.decapitalize(postfix);
                 if (postfix.equals(propertyName)) {
-                    result = element;
-                    break;
+                    return method;
                 }
             }
         }
-
-        return result;
+        return null;
     }
 
     private Method findMethod(Class<?> type, Object[] args) {
         Method[] methods = type.getMethods();
-
-        for (Method element : methods) {
-            if (action.equals(element.getName())
-                    && canInvokeWithArguments(element, args)) {
-                return element;
+        for (Method method : methods) {
+            if (action.equals(method.getName())
+                    && canInvokeWithArguments(method, args)) {
+                return method;
             }
         }
-
         return null;
     }
 
-    private static boolean isPrimitiveWrapper(Class<?> wrapper, Class<?> base) {
-        return (base == boolean.class) && (wrapper == Boolean.class)
-                || (base == byte.class) && (wrapper == Byte.class)
-                || (base == char.class) && (wrapper == Character.class)
-                || (base == short.class) && (wrapper == Short.class)
-                || (base == int.class) && (wrapper == Integer.class)
-                || (base == long.class) && (wrapper == Long.class)
-                || (base == float.class) && (wrapper == Float.class)
-                || (base == double.class) && (wrapper == Double.class);
-    }
-
-    private static boolean canInvokeWithArguments(Method m, Object[] arguments) {
-        Class<?>[] parameterTypes = m.getParameterTypes();
-
-        if (parameterTypes.length == arguments.length) {
-            for (int i = 0; i < arguments.length; ++i) {
-                Class<?> argumentType = (arguments[i] == null) ? null
-                        : arguments[i].getClass();
-
-                if ((argumentType == null)
-                        || isPrimitiveWrapper(argumentType, parameterTypes[i])) {
-                    // ... nothing to do - just not to break the cycle
-                } else if (!argumentType.isAssignableFrom(parameterTypes[i])) {
-                    return false;
-                }
-            }
-        } else {
+    private static boolean canInvokeWithArguments(Method method,
+            Object[] arguments) {
+        Class<?>[] parameterTypes = method.getParameterTypes();
+        if (parameterTypes.length != arguments.length) {
             return false;
         }
 
+        for (int index = 0; index < arguments.length; index++) {
+            Class<?> argumentType = (arguments[index] == null) ? null
+                    : arguments[index].getClass();
+            if (argumentType == null
+                    || BeansUtils.isPrimitiveWrapper(argumentType,
+                            parameterTypes[index])) {
+                continue;
+            }
+            if (!argumentType.isAssignableFrom(parameterTypes[index])) {
+                return false;
+            }
+        }
         return true;
-
     }
 
     private static boolean equalNames(Method m1, Method m2) {

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventSetDescriptor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventSetDescriptor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/EventSetDescriptor.java Mon Jun  7 08:06:18 2010
@@ -42,17 +42,15 @@ public class EventSetDescriptor extends 
     public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
             Class<?> listenerType, String listenerMethodName)
             throws IntrospectionException {
-        Method m;
-
         checkNotNull(sourceClass, eventSetName, listenerType,
                 listenerMethodName);
-
         setName(eventSetName);
         this.listenerType = listenerType;
-        m = findListenerMethodByName(listenerMethodName);
-        checkEventType(eventSetName, m);
+
+        Method method = findListenerMethodByName(listenerMethodName);
+        checkEventType(eventSetName, method);
         listenerMethodDescriptors = new ArrayList<MethodDescriptor>();
-        listenerMethodDescriptors.add(new MethodDescriptor(m));
+        listenerMethodDescriptors.add(new MethodDescriptor(method));
         addListenerMethod = findMethodByPrefix(sourceClass, "add", ""); //$NON-NLS-1$ //$NON-NLS-2$
         removeListenerMethod = findMethodByPrefix(sourceClass, "remove", ""); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -109,24 +107,24 @@ public class EventSetDescriptor extends 
 
     private Method findListenerMethodByName(String listenerMethodName)
             throws IntrospectionException {
-        Method method = null;
+        Method result = null;
         Method[] methods = listenerType.getMethods();
-        for (Method m : methods) {
-            if (listenerMethodName.equals(m.getName())) {
-                Class[] paramTypes = m.getParameterTypes();
+        for (Method method : methods) {
+            if (listenerMethodName.equals(method.getName())) {
+                Class<?>[] paramTypes = method.getParameterTypes();
                 if (paramTypes.length == 1
                         && paramTypes[0].getName().endsWith("Event")) { //$NON-NLS-1$
-                    method = m;
+                    result = method;
                     break;
                 }
 
             }
         }
-        if (null == method) {
+        if (null == result) {
             throw new IntrospectionException(Messages.getString("beans.31", //$NON-NLS-1$
                     listenerMethodName, listenerType.getName()));
         }
-        return method;
+        return result;
     }
 
     public EventSetDescriptor(String eventSetName, Class<?> listenerType,
@@ -234,7 +232,6 @@ public class EventSetDescriptor extends 
      */
     private static String extractShortClassName(String fullClassName) {
         int k = fullClassName.lastIndexOf('$');
-        
         k = (k == -1 ? fullClassName.lastIndexOf('.') : k);
         return fullClassName.substring(k + 1);
     }
@@ -255,28 +252,24 @@ public class EventSetDescriptor extends 
     }
 
     public Method[] getListenerMethods() {
-        int i = 0;
-
         if (listenerMethods != null) {
             return listenerMethods;
         }
 
         if (listenerMethodDescriptors != null) {
             listenerMethods = new Method[listenerMethodDescriptors.size()];
+            int index = 0;
             for (MethodDescriptor md : listenerMethodDescriptors) {
-                listenerMethods[i++] = md.getMethod();
+                listenerMethods[index++] = md.getMethod();
             }
             return listenerMethods;
         }
-
         return null;
     }
 
     public MethodDescriptor[] getListenerMethodDescriptors() {
         return listenerMethodDescriptors == null ? null
-                : listenerMethodDescriptors
-                        .toArray(new MethodDescriptor[listenerMethodDescriptors
-                                .size()]);
+                : listenerMethodDescriptors.toArray(new MethodDescriptor[0]);
     }
 
     public Method getRemoveListenerMethod() {
@@ -339,22 +332,22 @@ public class EventSetDescriptor extends 
     private Method findAddRemoveListnerMethodWithLessCheck(
             Class<?> sourceClass, String methodName)
             throws IntrospectionException {
-        Method method = null;
         Method[] methods = sourceClass.getMethods();
-        for (Method m : methods) {
-            if (m.getName().equals(methodName)) {
-                Class[] paramTypes = m.getParameterTypes();
+        Method result = null;
+        for (Method method : methods) {
+            if (method.getName().equals(methodName)) {
+                Class<?>[] paramTypes = method.getParameterTypes();
                 if (paramTypes.length == 1) {
-                    method = m;
+                    result = method;
                     break;
                 }
             }
         }
-        if (null == method) {
+        if (null == result) {
             throw new IntrospectionException(Messages.getString("beans.31", //$NON-NLS-1$
                     methodName, listenerType.getName()));
         }
-        return method;
+        return result;
     }
 
     /**
@@ -383,18 +376,18 @@ public class EventSetDescriptor extends 
         }
         String methodName = prefix + shortName + postfix;
         try {
-            if (prefix.equals("get")) { //$NON-NLS-1$
+            if ("get".equals(prefix)) { //$NON-NLS-1$
                 return sourceClass.getMethod(methodName);
             }
         } catch (NoSuchMethodException nsme) {
             return null;
         }
-        Method[] m = sourceClass.getMethods();
-        for (int i = 0; i < m.length; i++) {
-            if (m[i].getName().equals(methodName)) {
-                Class[] paramTypes = m[i].getParameterTypes();
+        Method[] methods = sourceClass.getMethods();
+        for (int i = 0; i < methods.length; i++) {
+            if (methods[i].getName().equals(methodName)) {
+                Class<?>[] paramTypes = methods[i].getParameterTypes();
                 if (paramTypes.length == 1) {
-                    return m[i];
+                    return methods[i];
                 }
             }
         }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/FeatureDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/FeatureDescriptor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/FeatureDescriptor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/FeatureDescriptor.java Mon Jun  7 08:06:18 2010
@@ -74,11 +74,10 @@ public class FeatureDescriptor {
      * @return The attribute's value.
      */
     public Object getValue(String attributeName) {
-        Object result = null;
         if (attributeName != null) {
-            result = values.get(attributeName);
+            return values.get(attributeName);
         }
-        return result;
+        return null;
     }
 
     /**

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java Mon Jun  7 08:06:18 2010
@@ -346,7 +346,7 @@ public class IndexedPropertyDescriptor e
         }
 
         // Validate the indexed write method.
-        Class[] indexedSetterArgs = indexSetter.getParameterTypes();
+        Class<?>[] indexedSetterArgs = indexSetter.getParameterTypes();
         if (indexedSetterArgs.length != 2) {
             // beans.5F=Indexed write method must take two arguments
             throw new IntrospectionException(Messages.getString("beans.5F")); //$NON-NLS-1$

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/PropertyEditorManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/PropertyEditorManager.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/PropertyEditorManager.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/PropertyEditorManager.java Mon Jun  7 08:06:18 2010
@@ -24,8 +24,7 @@ public class PropertyEditorManager {
 
     private static String[] path = { "org.apache.harmony.beans.editors" }; //$NON-NLS-1$
 
-    private static final Map<Class<?>, Class<?>> registeredEditors
-               = new HashMap<Class<?>, Class<?>>();
+    private static final Map<Class<?>, Class<?>> registeredEditors = new HashMap<Class<?>, Class<?>>();
 
     public PropertyEditorManager() {
         // expected
@@ -48,31 +47,21 @@ public class PropertyEditorManager {
         }
     }
 
-    private static PropertyEditor loadEditor(Class<?> targetType, String className)
-            throws ClassNotFoundException, IllegalAccessException,
-                   InstantiationException {
+    private static PropertyEditor loadEditor(Class<?> targetType,
+            String className) throws ClassNotFoundException,
+            IllegalAccessException, InstantiationException {
         ClassLoader loader = targetType.getClassLoader();
-        Class<?> editorClass = null;
-
+        if (loader == null) {
+            loader = ClassLoader.getSystemClassLoader();
+        }
         try {
-            if (loader != null) {
-                editorClass = loader.loadClass(className);
-            } else {
-                loader = ClassLoader.getSystemClassLoader();
-
-                if (loader != null) {
-                    editorClass = loader.loadClass(className);
-                }
-            }
+            return (PropertyEditor) loader.loadClass(className).newInstance();
         } catch (ClassNotFoundException e) {
-            // expected
+            // Ignored
         }
 
-        if (editorClass == null) {
-            loader = Thread.currentThread().getContextClassLoader();
-            editorClass = loader.loadClass(className);
-        }
-        return (PropertyEditor) editorClass.newInstance();
+        return (PropertyEditor) Thread.currentThread().getContextClassLoader()
+                .loadClass(className).newInstance();
     }
 
     public static synchronized PropertyEditor findEditor(Class<?> targetType) {
@@ -102,9 +91,12 @@ public class PropertyEditorManager {
                         editorClassName.lastIndexOf('.') + 1));
 
         for (String element : path) {
+            if (element == null) {
+                continue;
+            }
             try {
-                editorClassName = element + '.' + shortEditorClassName;
-                return loadEditor(targetType, editorClassName);
+                return loadEditor(targetType, element + '.'
+                        + shortEditorClassName);
             } catch (Exception e) {
                 // expected
             }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ProxyPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ProxyPersistenceDelegate.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ProxyPersistenceDelegate.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ProxyPersistenceDelegate.java Mon Jun  7 08:06:18 2010
@@ -24,7 +24,7 @@ class ProxyPersistenceDelegate extends D
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
         assert oldInstance instanceof Proxy : oldInstance;
-        Class[] interfaces = oldInstance.getClass().getInterfaces();
+        Class<?>[] interfaces = oldInstance.getClass().getInterfaces();
         InvocationHandler handler = Proxy.getInvocationHandler(oldInstance);
         return new Expression(oldInstance, Proxy.class, "newProxyInstance", //$NON-NLS-1$
                 new Object[] { oldInstance.getClass().getClassLoader(), interfaces, handler });

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ReferenceMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ReferenceMap.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ReferenceMap.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/ReferenceMap.java Mon Jun  7 08:06:18 2010
@@ -15,12 +15,11 @@
  * limitations under the License.
  */
 
-
 package java.beans;
 
 /**
  * A simple map.
- * Keys are equal iff they are the same object (reference equals).
+ * Keys are equal if they are the same object (reference equals).
  * The put() do not check key duplication, so always do a get() before put().
  * Noop if either key or value is null.
  * 

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/StandardBeanInfo.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/StandardBeanInfo.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/StandardBeanInfo.java Mon Jun  7 08:06:18 2010
@@ -77,6 +77,8 @@ class StandardBeanInfo extends SimpleBea
 
     private PropertyDescriptor[] properties = null;
 
+    private BeanDescriptor beanDescriptor = null;
+
     BeanInfo[] additionalBeanInfo = null;
 
     private Class<?> beanClass;
@@ -175,13 +177,15 @@ class StandardBeanInfo extends SimpleBea
 
     @Override
     public BeanDescriptor getBeanDescriptor() {
-        if (explicitBeanInfo != null) {
-            BeanDescriptor beanDesc = explicitBeanInfo.getBeanDescriptor();
-            if (beanDesc != null) {
-                return beanDesc;
+        if (beanDescriptor == null) {
+            if (explicitBeanInfo != null) {
+                beanDescriptor = explicitBeanInfo.getBeanDescriptor();
+            }
+            if (beanDescriptor == null) {
+                beanDescriptor = new BeanDescriptor(beanClass);
             }
         }
-        return new BeanDescriptor(beanClass);
+        return beanDescriptor;
     }
 
     @Override
@@ -598,7 +602,7 @@ class StandardBeanInfo extends SimpleBea
 
     private static String getQualifiedName(Method method) {
         String qualifiedName = method.getName();
-        Class[] paramTypes = method.getParameterTypes();
+        Class<?>[] paramTypes = method.getParameterTypes();
         if (paramTypes != null) {
             for (int i = 0; i < paramTypes.length; i++) {
                 qualifiedName += "_" + paramTypes[i].getName(); //$NON-NLS-1$
@@ -796,7 +800,7 @@ class StandardBeanInfo extends SimpleBea
     @SuppressWarnings("nls")
     private void introspectPropertyListener(Method theMethod) {
         String methodName = theMethod.getName();
-        Class[] param = theMethod.getParameterTypes();
+        Class<?>[] param = theMethod.getParameterTypes();
         if (param.length != 1) {
             return;
         }
@@ -969,8 +973,8 @@ class StandardBeanInfo extends SimpleBea
             Method normalSetter = null;
             Method indexedSetter = null;
 
-            Class normalPropType = null;
-            Class indexedPropType = null;
+            Class<?> normalPropType = null;
+            Class<?> indexedPropType = null;
 
             if (getters == null) {
                 getters = new ArrayList<Method>();
@@ -1007,7 +1011,7 @@ class StandardBeanInfo extends SimpleBea
             // retrieve normal setter
             if (normalGetter != null) {
                 // Now we will try to look for normal setter of the same type.
-                Class propertyType = normalGetter.getReturnType();
+                Class<?> propertyType = normalGetter.getReturnType();
 
                 for (Method setter : setters) {
                     if (setter.getParameterTypes().length == 1
@@ -1031,7 +1035,7 @@ class StandardBeanInfo extends SimpleBea
             // retrieve indexed setter
             if (indexedGetter != null) {
                 // Now we will try to look for indexed setter of the same type.
-                Class propertyType = indexedGetter.getReturnType();
+                Class<?> propertyType = indexedGetter.getReturnType();
 
                 for (Method setter : setters) {
                     if (setter.getParameterTypes().length == 2
@@ -1403,7 +1407,7 @@ class StandardBeanInfo extends SimpleBea
         Method[] methods = listenerType.getDeclaredMethods();
         ArrayList<Method> list = new ArrayList<Method>();
         for (int i = 0; i < methods.length; i++) {
-            Class[] paramTypes = methods[i].getParameterTypes();
+            Class<?>[] paramTypes = methods[i].getParameterTypes();
             if (paramTypes.length != 1) {
                 continue;
             }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Statement.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Statement.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Statement.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/Statement.java Mon Jun  7 08:06:18 2010
@@ -43,7 +43,7 @@ public class Statement {
     private Object[] arguments;
     
     // cache used methods of specified target class to accelerate method search
-    private static WeakHashMap<Class, Method[]> cache = new WeakHashMap<Class, Method[]>();
+    private static WeakHashMap<Class<?>, Method[]> cache = new WeakHashMap<Class<?>, Method[]>();
     
     // the special method name donating constructors
     static final String CONSTRUCTOR_NAME = "new"; //$NON-NLS-1$
@@ -126,13 +126,13 @@ public class Statement {
                 result = method.invoke(null, args);
             } else if (theMethodName.equals("newInstance") //$NON-NLS-1$
                     && theTarget == Array.class) {
-                Class<?> componentType = (Class) theArguments[0];
+                Class<?> componentType = (Class<?>) theArguments[0];
                 int length = ((Integer) theArguments[1]).intValue();
                 result = Array.newInstance(componentType, length);
             } else if (theMethodName.equals("new") //$NON-NLS-1$
                     || theMethodName.equals("newInstance")) { //$NON-NLS-1$
-                if (theTarget instanceof Class) {
-                    Constructor<?> constructor = findConstructor((Class)theTarget, theArguments);
+                if (theTarget instanceof Class<?>) {
+                    Constructor<?> constructor = findConstructor((Class<?>)theTarget, theArguments);
                     result = constructor.newInstance(theArguments);
                 } else {
                     if ("new".equals(theMethodName)) { //$NON-NLS-1$
@@ -146,7 +146,7 @@ public class Statement {
             } else if (theMethodName.equals("newArray")) {//$NON-NLS-1$
                 // create a new array instance without length attribute
                 int length = theArguments.length;
-                Class clazz = (Class) theTarget;
+                Class<?> clazz = (Class<?>) theTarget;
 
                 // check the element types of array
                 for (int i = 0; i < length; i++) {
@@ -170,7 +170,7 @@ public class Statement {
                     System.arraycopy(theArguments, 0, result, 0, length);
                 }
                 return result;
-            } else if (theTarget instanceof Class) {
+            } else if (theTarget instanceof Class<?>) {
                 Method method = null;
                 boolean found = false;
                 try {
@@ -180,7 +180,7 @@ public class Statement {
                      * differs from Class itself
                      */
                     if (theTarget != Class.class) {
-                        method = findMethod((Class) theTarget, theMethodName, theArguments, true);
+                        method = findMethod((Class<?>) theTarget, theMethodName, theArguments, true);
                         result = method.invoke(null, theArguments);
                         found = true;
                     }
@@ -204,8 +204,8 @@ public class Statement {
                         result = method.invoke(theTarget, theArguments);
                     }
                 }
-            } else if (theTarget instanceof Iterator){
-            	final Iterator<?> iterator = (Iterator) theTarget;
+            } else if (theTarget instanceof Iterator<?>){
+            	final Iterator<?> iterator = (Iterator<?>) theTarget;
 				final Method method = findMethod(theTarget.getClass(), theMethodName,
 						theArguments, false);
 				if (iterator.hasNext()) {
@@ -237,7 +237,7 @@ public class Statement {
         return result;
     }
     
-    private void arrayCopy(Class type, Object[] src, Object dest, int length) {
+    private void arrayCopy(Class<?> type, Object[] src, Object dest, int length) {
         if (type == boolean.class) {
             boolean[] destination = (boolean[]) dest;
             for (int i = 0; i < length; i++) {
@@ -438,11 +438,11 @@ public class Statement {
     static boolean isStaticMethodCall(Statement stmt) {
         Object target = stmt.getTarget();
         String mName = stmt.getMethodName();
-        if (!(target instanceof Class)) {
+        if (!(target instanceof Class<?>)) {
             return false;
         }
         try {
-            Statement.findMethod((Class) target, mName, stmt.getArguments(), true);
+            Statement.findMethod((Class<?>) target, mName, stmt.getArguments(), true);
             return true;
         } catch (NoSuchMethodException e) {
             return false;

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java Mon Jun  7 08:06:18 2010
@@ -27,7 +27,8 @@ class UtilCollectionPersistenceDelegate 
     protected void initialize(Class<?> type, Object oldInstance,
             Object newInstance, Encoder enc) {
 
-        Collection<?> oldList = (Collection) oldInstance, newList = (Collection)newInstance;
+        Collection<?> oldList = (Collection<?>) oldInstance;
+        Collection<?> newList = (Collection<?>) newInstance;
         Iterator<?> oldIterator = oldList.iterator(), newIterator = newList.iterator();
         for (; oldIterator.hasNext();) {
             Expression getterExp = new Expression(oldIterator, "next", null);

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java Mon Jun  7 08:06:18 2010
@@ -25,7 +25,7 @@ class UtilListPersistenceDelegate extend
     protected void initialize(Class<?> type, Object oldInstance,
             Object newInstance, Encoder enc) {
 
-        List<?> list = (List) oldInstance;
+        List<?> list = (List<?>) oldInstance;
         int size = list.size();
         for (int i = 0; i < size; i++) {
             Expression getterExp = new Expression(oldInstance, "get",

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLDecoder.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLDecoder.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/XMLDecoder.java Mon Jun  7 08:06:18 2010
@@ -330,7 +330,7 @@ public class XMLDecoder {
                 method = args.size() == 1 ? "get" : "set";
             }
             if (elem.fromField) {
-                Field f = ((Class) elem.target).getField(method);
+                Field f = ((Class<?>) elem.target).getField(method);
                 return (new Expression(f, "get", new Object[] { null }))
                         .getValue();
             }
@@ -342,7 +342,7 @@ public class XMLDecoder {
                 if ("getOwner".equals(method)) {
                     return owner;
                 }
-                Class[] c = new Class[args.size()];
+                Class<?>[] c = new Class[args.size()];
                 for (int i = 0; i < args.size(); i++) {
                     Object arg = args.get(i);
                     c[i] = (arg == null ? null: arg.getClass());
@@ -358,7 +358,7 @@ public class XMLDecoder {
 
                 // Find the specific method matching the parameter
                 Method mostSpecificMethod = findMethod(
-                        owner instanceof Class ? (Class) owner : owner
+                        owner instanceof Class<?> ? (Class<?>) owner : owner
                                 .getClass(), method, c);
 
                 return mostSpecificMethod.invoke(owner, args.toArray());
@@ -369,8 +369,8 @@ public class XMLDecoder {
             return exp.getValue();
         }
 
-        private Method findMethod(Class clazz, String methodName,
-                Class[] clazzes) throws Exception {
+        private Method findMethod(Class<?> clazz, String methodName,
+                Class<?>[] clazzes) throws Exception {
             Method[] methods = clazz.getMethods();
             ArrayList<Method> matchMethods = new ArrayList<Method>();
 
@@ -379,7 +379,7 @@ public class XMLDecoder {
                 if (!methodName.equals(method.getName())) {
                     continue;
                 }
-                Class[] parameterTypes = method.getParameterTypes();
+                Class<?>[] parameterTypes = method.getParameterTypes();
                 if (parameterTypes.length != clazzes.length) {
                     continue;
                 }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Argument.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Argument.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Argument.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Argument.java Mon Jun  7 08:06:18 2010
@@ -23,7 +23,7 @@ public class Argument {
 
     private Object value;
 
-    private Class[] interfaces;
+    private Class<?>[] interfaces;
 
     public Argument(Object value) {
         this.value = value;
@@ -47,7 +47,7 @@ public class Argument {
         return value;
     }
 
-    public Class[] getInterfaces() {
+    public Class<?>[] getInterfaces() {
         return interfaces;
     }
 
@@ -56,7 +56,7 @@ public class Argument {
         this.interfaces = type.getInterfaces();
     }
 
-    public void setInterfaces(Class[] interfaces) {
+    public void setInterfaces(Class<?>[] interfaces) {
         this.interfaces = interfaces;
     }
 }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/BeansUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/BeansUtils.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/BeansUtils.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/BeansUtils.java Mon Jun  7 08:06:18 2010
@@ -18,40 +18,49 @@
 package org.apache.harmony.beans;
 
 public class BeansUtils {
-    
-    public static final int getHashCode(Object o) {
-        return o != null ? o.hashCode() : 0;
+
+    public static final int getHashCode(Object obj) {
+        return obj != null ? obj.hashCode() : 0;
     }
-    
-    public static final int getHashCode(boolean b) {
-        return b?1:0;
+
+    public static final int getHashCode(boolean bool) {
+        return bool ? 1 : 0;
     }
-    
-    public static String toASCIILowerCase(String s) {
-        int len = s.length();
-        StringBuilder buffer = new StringBuilder(len);
-        for (int i = 0; i < len; i++) {
-            char c = s.charAt(i);
-            if ('A' <= c && c <= 'Z') {
-                buffer.append((char) (c + ('a' - 'A')));
+
+    public static String toASCIILowerCase(String string) {
+        char[] charArray = string.toCharArray();
+        StringBuilder sb = new StringBuilder(charArray.length);
+        for (int index = 0; index < charArray.length; index++) {
+            if ('A' <= charArray[index] && charArray[index] <= 'Z') {
+                sb.append((char) (charArray[index] + ('a' - 'A')));
             } else {
-                buffer.append(c);
+                sb.append(charArray[index]);
             }
         }
-        return buffer.toString();
+        return sb.toString();
     }
-    
-    public static String toASCIIUpperCase(String s) {
-        int len = s.length();
-        StringBuilder buffer = new StringBuilder(len);
-        for (int i = 0; i < len; i++) {
-            char c = s.charAt(i);
-            if ('a' <= c && c <= 'z') {
-                buffer.append((char) (c - ('a' - 'A')));
+
+    public static String toASCIIUpperCase(String string) {
+        char[] charArray = string.toCharArray();
+        StringBuilder sb = new StringBuilder(charArray.length);
+        for (int index = 0; index < charArray.length; index++) {
+            if ('a' <= charArray[index] && charArray[index] <= 'z') {
+                sb.append((char) (charArray[index] - ('a' - 'A')));
             } else {
-                buffer.append(c);
+                sb.append(charArray[index]);
             }
         }
-        return buffer.toString();
+        return sb.toString();
+    }
+
+    public static boolean isPrimitiveWrapper(Class<?> wrapper, Class<?> base) {
+        return (base == boolean.class) && (wrapper == Boolean.class)
+                || (base == byte.class) && (wrapper == Byte.class)
+                || (base == char.class) && (wrapper == Character.class)
+                || (base == short.class) && (wrapper == Short.class)
+                || (base == int.class) && (wrapper == Integer.class)
+                || (base == long.class) && (wrapper == Long.class)
+                || (base == float.class) && (wrapper == Float.class)
+                || (base == double.class) && (wrapper == Double.class);
     }
 }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Command.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Command.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Command.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/Command.java Mon Jun  7 08:06:18 2010
@@ -495,7 +495,7 @@ public class Command {
 
                     if (isField()) {
                         String fieldName = getAttr("field"); //$NON-NLS-1$
-                        target = ((Class) target).getField(fieldName);
+                        target = ((Class<?>) target).getField(fieldName);
                     }
                 } else {
                     throw new Exception(Messages.getString(

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/BooleanEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/BooleanEditor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/BooleanEditor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/BooleanEditor.java Mon Jun  7 08:06:18 2010
@@ -34,9 +34,9 @@ public final class BooleanEditor extends
         if(text == null){
             throw new NullPointerException();
         }
-        if(text.equalsIgnoreCase("true") || text.equalsIgnoreCase("false")){
-            setValue(Boolean.valueOf(text));
-        }else{
+        if ("true".equalsIgnoreCase(text) || "false".equalsIgnoreCase(text)) { //$NON-NLS-1$ //$NON-NLS-2$
+            setValue(new Boolean(text));
+        } else {
             throw new IllegalArgumentException(text);
         }
     }
@@ -68,12 +68,10 @@ public final class BooleanEditor extends
     }
 
     private String getValueAsString() {
-        String result = null;
         Object value = getValue();
         if (value != null) {
-            Boolean bValue = (Boolean) value;
-            result = bValue.toString();
+            return ((Boolean) value).toString();
         }
-        return result;
+        return null;
     }
 }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ByteEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ByteEditor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ByteEditor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ByteEditor.java Mon Jun  7 08:06:18 2010
@@ -36,7 +36,7 @@ public final class ByteEditor extends Pr
 
     @Override
     public String getJavaInitializationString() {
-        return new StringBuilder("((byte)").append(getValue()).append(")").toString();
+        return new StringBuilder("((byte)").append(getValue()).append(")").toString(); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     @Override

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ColorEditor.java Mon Jun  7 08:06:18 2010
@@ -58,15 +58,17 @@ public class ColorEditor extends Panel i
     }
 
     public String getJavaInitializationString() {
-        String result = null;
-        Color color = (Color) getValue();
-        if (color != null) {
-            int red = color.getRed();
-            int green = color.getGreen();
-            int blue = color.getBlue();
-            result = "new java.awt.Color(" + red + "," + green + "," + blue + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+        Color value = (Color) getValue();
+        if (value != null) {
+            StringBuilder sb = new StringBuilder("new java.awt.Color("); //$NON-NLS-1$
+            sb.append(value.getRed());
+            sb.append(',');
+            sb.append(value.getGreen());
+            sb.append(',');
+            sb.append(value.getBlue() + ")"); //$NON-NLS-1$
+            return sb.toString();
         }
-        return result;
+        return null;
     }
 
     public String[] getTags() {
@@ -81,9 +83,8 @@ public class ColorEditor extends Panel i
         this.value = (Color) value;
         PropertyChangeEvent changeAllEvent = new PropertyChangeEvent(this,
                 "value", oldValue, value); //$NON-NLS-1$
-        PropertyChangeListener[] copy = new PropertyChangeListener[listeners
-                .size()];
-        listeners.toArray(copy);
+        PropertyChangeListener[] copy = listeners
+                .toArray(new PropertyChangeListener[0]);
         for (PropertyChangeListener listener : copy) {
             listener.propertyChange(changeAllEvent);
         }
@@ -91,17 +92,17 @@ public class ColorEditor extends Panel i
 
     @SuppressWarnings("nls")
     public String getAsText() {
-        Color c = (Color) getValue();
-        if (null == c) {
-            return "null";
-        }
-        StringBuilder sb = new StringBuilder(14);
-        sb.append(c.getRed());
-        sb.append(",");
-        sb.append(c.getGreen());
-        sb.append(",");
-        sb.append(c.getBlue());
-        return sb.toString();
+        Color value = (Color) getValue();
+        if (value != null) {
+            StringBuilder sb = new StringBuilder(14);
+            sb.append(value.getRed());
+            sb.append(',');
+            sb.append(value.getGreen());
+            sb.append(',');
+            sb.append(value.getBlue());
+            return sb.toString();
+        }
+        return ""; //$NON-NLS-1$
     }
 
     @SuppressWarnings("nls")
@@ -109,20 +110,17 @@ public class ColorEditor extends Panel i
         if (null == text) {
             throw new NullPointerException();
         }
-
-        int r = 0;
-        int g = 0;
-        int b = 0;
         String aText = text;
         try {
-            int index = text.indexOf(",");
-            r = Integer.parseInt(text.substring(0, index));
-            aText = text.substring(index + 1);
-            index = aText.indexOf(",");
-            g = Integer.parseInt(aText.substring(0, index));
-            aText = aText.substring(index + 1);
-            b = Integer.parseInt(aText);
-            setValue(new Color(r, g, b));
+            int commaIndex = aText.indexOf(',');
+            int red = Integer.parseInt(aText.substring(0, commaIndex));
+            aText = aText.substring(commaIndex + 1);
+            commaIndex = aText.indexOf(',');
+            int green = Integer.parseInt(aText.substring(0, commaIndex));
+            aText = aText.substring(commaIndex + 1);
+            int blue = Integer.parseInt(aText);
+            
+            setValue(new Color(red, green, blue));
         } catch (Exception e) {
             throw new IllegalArgumentException(aText);
         }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FloatEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FloatEditor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FloatEditor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FloatEditor.java Mon Jun  7 08:06:18 2010
@@ -36,7 +36,7 @@ public final class FloatEditor extends P
 
     @Override
     public String getJavaInitializationString() {
-        return getValue()+"F";
+        return getValue() + "F"; //$NON-NLS-1$
     }
 
     @Override

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FontEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FontEditor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FontEditor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/FontEditor.java Mon Jun  7 08:06:18 2010
@@ -58,14 +58,16 @@ public class FontEditor extends Panel im
     }
 
     public String getJavaInitializationString() {
-        String result = null;
-        if (value!= null) {
-            String name = value.getName();
-            int style = value.getStyle();
-            int size = value.getSize();
-            result = "new Font(" + name + "," + style + "," + size + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+        if (value != null) {
+            StringBuilder sb = new StringBuilder("new Font("); //$NON-NLS-1$
+            sb.append(value.getName());
+            sb.append(',');
+            sb.append(value.getStyle());
+            sb.append(',');
+            sb.append(value.getSize() + ")"); //$NON-NLS-1$
+            return sb.toString();
         }
-        return result;
+        return null;
     }
 
     public String[] getTags() {
@@ -77,8 +79,8 @@ public class FontEditor extends Panel im
         value = (Font)newValue;
         PropertyChangeEvent changeAllEvent = new PropertyChangeEvent(this,
                 "value", oldValue, value); //$NON-NLS-1$
-        PropertyChangeListener[] copy = new PropertyChangeListener[listeners.size()];
-        listeners.toArray(copy);
+        PropertyChangeListener[] copy = listeners
+                .toArray(new PropertyChangeListener[0]);
         for (PropertyChangeListener listener : copy) {
             listener.propertyChange(changeAllEvent);
         }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/IntEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/IntEditor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/IntEditor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/IntEditor.java Mon Jun  7 08:06:18 2010
@@ -52,12 +52,10 @@ public final class IntEditor extends Pro
     }
 
     private String getValueAsText() {
-        String result = null;
         Object value = getValue();
         if (value != null) {
-            Integer iValue = (Integer) value;
-            result = iValue.toString();
+            return ((Integer) value).toString();
         }
-        return result;
+        return null;
     }
 }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/LongEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/LongEditor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/LongEditor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/LongEditor.java Mon Jun  7 08:06:18 2010
@@ -36,7 +36,7 @@ public final class LongEditor extends Pr
 
     @Override
     public String getJavaInitializationString() {
-        return getValue()+"L";
+        return getValue() + "L"; //$NON-NLS-1$
     }
 
     @Override

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ShortEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ShortEditor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ShortEditor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/ShortEditor.java Mon Jun  7 08:06:18 2010
@@ -36,7 +36,8 @@ public final class ShortEditor extends P
 
     @Override
     public String getJavaInitializationString() {
-        return new StringBuilder().append("((short)").append(getValue()).append(")").toString();
+        return new StringBuilder()
+                .append("((short)").append(getValue()).append(")").toString(); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     @Override

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java Mon Jun  7 08:06:18 2010
@@ -37,7 +37,7 @@ public final class StringEditor extends 
 
     @Override
     public String getJavaInitializationString() {
-        Object value = getValue(); 
-        return value==null?"\"null\"":"\""+value+"\"";
+        Object value = getValue();
+        return value == null ? "\"null\"" : "\"" + value + "\"";
     }
 }

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java Mon Jun  7 08:06:18 2010
@@ -106,6 +106,13 @@ public class EventHandlerTest extends Te
 
         assertEquals(invocationObject, handler.getTarget());
         assertEquals(invocationObject.getSomeText(), getText());
+        try {
+            handler.invoke(proxy, null, new Object[] { new ActionEvent(this, 0,
+                    "") });
+            fail("should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // Expected
+        }
     }
 
     /**

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java Mon Jun  7 08:06:18 2010
@@ -251,11 +251,25 @@ public class FeatureDescriptorTest exten
         fd.setValue(attributeName, value);
         assertSame(value, fd.getValue(attributeName));
 
-        Object newValue = null;
         try {
-            fd.setValue(attributeName, newValue);
-            fail("Should throw NullPointerException.");
+            fd.setValue(null, value);
+            fail("Should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
+        }
+
+        try {
+            fd.setValue(attributeName, null);
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // Expected
+        }
+
+        try {
+            fd.setValue(null, null);
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // Expected
         }
     }
 

Modified: harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java?rev=952132&r1=952131&r2=952132&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java Mon Jun  7 08:06:18 2010
@@ -122,6 +122,11 @@ public class IntrospectorTest extends Te
         }
     }
 
+    public void testBeanDescriptor_Same() throws Exception {
+        BeanInfo beanInfo = Introspector.getBeanInfo(MockJavaBean.class);
+        assertSame(beanInfo.getBeanDescriptor(), beanInfo.getBeanDescriptor());
+    }
+
     /**
      * The test checks the getMethodDescriptor method
      * 



Mime
View raw message