harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r557504 - in /harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans: DefaultPersistenceDelegate.java EventSetDescriptor.java PropertyDescriptor.java StandardBeanInfo.java VetoableChangeSupport.java
Date Thu, 19 Jul 2007 06:30:03 GMT
Author: tonywu
Date: Wed Jul 18 23:30:02 2007
New Revision: 557504

URL: http://svn.apache.org/viewvc?view=rev&rev=557504
Log:
Tidy up compiler warning and format code, no functional change

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java?view=diff&rev=557504&r1=557503&r2=557504
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java Wed Jul 18 23:30:02 2007
@@ -51,7 +51,7 @@
     /**
      * Constructs a <code>DefaultPersistenceDelegate</code> instance that
      * supports the persistence of a bean which has a default constructor.
-     *  
+     * 
      */
     public DefaultPersistenceDelegate() {
         // empty
@@ -169,6 +169,7 @@
     /*
      * Get the field value of an object using privileged code.
      */
+    @SuppressWarnings("unchecked")
     private Object getFieldValue(Object oldInstance, String fieldName)
             throws NoSuchFieldException, IllegalAccessException {
         Class c = oldInstance.getClass();
@@ -199,7 +200,7 @@
 
         // Invoke read method to get the value if found
         if (null != getter) {
-            return getter.invoke(oldInstance, (Object[])null);
+            return getter.invoke(oldInstance, (Object[]) null);
         }
 
         // Otherwise, try to access the field directly
@@ -237,8 +238,7 @@
             try {
                 info = Introspector.getBeanInfo(oldInstance.getClass(),
                         Introspector.IGNORE_ALL_BEANINFO);
-                proDscMap = internalAsMap(info
-                        .getPropertyDescriptors());
+                proDscMap = internalAsMap(info.getPropertyDescriptors());
             } catch (IntrospectionException ex) {
                 enc.getExceptionListener().exceptionThrown(ex);
                 throw new Error(ex);
@@ -251,13 +251,13 @@
                 if (null == propertyName || 0 == propertyName.length()) {
                     continue;
                 }
-                
+
                 // Get the value for each property of the given instance
                 try {
                     args[i] = getPropertyValue(proDscMap, oldInstance,
                             this.propertyNames[i]);
-                } catch (Exception ex) {                  
-                        enc.getExceptionListener().exceptionThrown(ex);
+                } catch (Exception ex) {
+                    enc.getExceptionListener().exceptionThrown(ex);
                 }
             }
         }
@@ -265,8 +265,9 @@
         return new Expression(oldInstance, oldInstance.getClass(),
                 Statement.CONSTRUCTOR_NAME, args);
     }
-    
-    private static HashMap<String, PropertyDescriptor> internalAsMap(PropertyDescriptor[] propertyDescs) {
+
+    private static HashMap<String, PropertyDescriptor> internalAsMap(
+            PropertyDescriptor[] propertyDescs) {
         HashMap<String, PropertyDescriptor> map = new HashMap<String, PropertyDescriptor>();
         for (int i = 0; i < propertyDescs.length; i++) {
             map.put(propertyDescs[i].getName(), propertyDescs[i]);

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java?view=diff&rev=557504&r1=557503&r2=557504
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java Wed Jul 18 23:30:02 2007
@@ -38,10 +38,6 @@
     private boolean unicast;
 
     private boolean inDefaultEventSet = true;
-    
-    private Class awtEventListener;
-    
-    private Class awtEventAction;
 
     public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
             Class<?> listenerType, String listenerMethodName)
@@ -57,18 +53,14 @@
         checkEventType(eventSetName, m);
         listenerMethodDescriptors = new ArrayList<MethodDescriptor>();
         listenerMethodDescriptors.add(new MethodDescriptor(m));
-        addListenerMethod = findMethodByPrefix(
-                sourceClass, "add", ""); //$NON-NLS-1$ //$NON-NLS-2$
-        removeListenerMethod = findMethodByPrefix(
-                sourceClass, "remove", ""); //$NON-NLS-1$ //$NON-NLS-2$
+        addListenerMethod = findMethodByPrefix(sourceClass, "add", ""); //$NON-NLS-1$ //$NON-NLS-2$
+        removeListenerMethod = findMethodByPrefix(sourceClass, "remove", ""); //$NON-NLS-1$ //$NON-NLS-2$
 
         if (addListenerMethod == null || removeListenerMethod == null) {
-            throw new IntrospectionException(
-                    Messages.getString("beans.38")); //$NON-NLS-1$
+            throw new IntrospectionException(Messages.getString("beans.38")); //$NON-NLS-1$
         }
 
-        getListenerMethod = findMethodByPrefix(
-                sourceClass, "get", "s"); //$NON-NLS-1$ //$NON-NLS-2$
+        getListenerMethod = findMethodByPrefix(sourceClass, "get", "s"); //$NON-NLS-1$ //$NON-NLS-2$
         unicast = isUnicastByDefault(addListenerMethod);
     }
 
@@ -76,10 +68,9 @@
             Class<?> listenerType, String[] listenerMethodNames,
             String addListenerMethodName, String removeListenerMethodName)
             throws IntrospectionException {
-        this(sourceClass, eventSetName, listenerType,
-                listenerMethodNames, addListenerMethodName,
-                removeListenerMethodName, null);
-        
+        this(sourceClass, eventSetName, listenerType, listenerMethodNames,
+                addListenerMethodName, removeListenerMethodName, null);
+
     }
 
     public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
@@ -97,27 +88,27 @@
         for (String element : listenerMethodNames) {
             Method m = findListenerMethodByName(element);
 
-            //checkEventType(eventSetName, m);
+            // checkEventType(eventSetName, m);
             listenerMethodDescriptors.add(new MethodDescriptor(m));
         }
 
         if (addListenerMethodName != null) {
-            this.addListenerMethod = findAddRemoveListenerMethod(
-                    sourceClass, addListenerMethodName);
+            this.addListenerMethod = findAddRemoveListenerMethod(sourceClass,
+                    addListenerMethodName);
         }
         if (removeListenerMethodName != null) {
             this.removeListenerMethod = findAddRemoveListenerMethod(
                     sourceClass, removeListenerMethodName);
         }
         if (getListenerMethodName != null) {
-            this.getListenerMethod = findGetListenerMethod(
-                    sourceClass, getListenerMethodName);
+            this.getListenerMethod = findGetListenerMethod(sourceClass,
+                    getListenerMethodName);
         }
         this.unicast = isUnicastByDefault(addListenerMethod);
     }
 
-    private Method findListenerMethodByName(
-            String listenerMethodName) throws IntrospectionException {
+    private Method findListenerMethodByName(String listenerMethodName)
+            throws IntrospectionException {
         Method method = null;
         Method[] methods = listenerType.getMethods();
         for (Method m : methods) {
@@ -128,7 +119,7 @@
                     method = m;
                     break;
                 }
-                
+
             }
         }
         if (null == method) {
@@ -184,13 +175,8 @@
             this.listenerMethodDescriptors = new ArrayList<MethodDescriptor>();
 
             for (MethodDescriptor element : listenerMethodDescriptors) {
-                Method listenerMethod = element.getMethod();
-
-                // XXX
-                // checkEventType(eventSetName, listenerMethod);
-                // if (checkMethod(listenerType, listenerMethod)) {
+                element.getMethod();
                 this.listenerMethodDescriptors.add(element);
-                //                }
             }
         }
     }
@@ -213,36 +199,39 @@
     }
 
     /**
-     * Checks that given listener method has an argument of the valid type. 
-     * @param eventSetName event set name
-     * @param listenerMethod listener method
-     * @throws IntrospectionException if check fails
+     * Checks that given listener method has an argument of the valid type.
+     * 
+     * @param eventSetName
+     *            event set name
+     * @param listenerMethod
+     *            listener method
+     * @throws IntrospectionException
+     *             if check fails
      */
     private static void checkEventType(String eventSetName,
             Method listenerMethod) throws IntrospectionException {
         Class<?>[] params = listenerMethod.getParameterTypes();
         String firstParamTypeName = null;
         String eventTypeName = prepareEventTypeName(eventSetName);
-        
+
         if (params.length > 0) {
-            firstParamTypeName = BeanInfoImpl.extractShortClassName(
-                    params[0].getName());
+            firstParamTypeName = BeanInfoImpl.extractShortClassName(params[0]
+                    .getName());
+        }
+
+        if (firstParamTypeName == null
+                || !firstParamTypeName.equals(eventTypeName)) {
+            throw new IntrospectionException(Messages.getString("beans.51", //$NON-NLS-1$
+                    listenerMethod.getName(), eventTypeName));
         }
-        
-        if (firstParamTypeName == null ||
-                !firstParamTypeName.equals(eventTypeName)) {
-            throw new IntrospectionException(
-                    Messages.getString("beans.51", //$NON-NLS-1$
-                            listenerMethod.getName(), eventTypeName));
-        }   
     }
-    
+
     private static String prepareEventTypeName(String eventSetName) {
         StringBuilder sb = new StringBuilder();
 
         if (eventSetName != null && eventSetName.length() > 0) {
             sb.append(Character.toUpperCase(eventSetName.charAt(0)));
-            
+
             if (eventSetName.length() > 1) {
                 sb.append(eventSetName.substring(1));
             }
@@ -251,7 +240,7 @@
         sb.append("Event"); //$NON-NLS-1$
         return sb.toString();
     }
-    
+
     public Method[] getListenerMethods() {
         int i = 0;
 
@@ -271,9 +260,10 @@
     }
 
     public MethodDescriptor[] getListenerMethodDescriptors() {
-        return listenerMethodDescriptors == null ? null :
-                listenerMethodDescriptors.toArray(
-                       new MethodDescriptor[listenerMethodDescriptors.size()]);
+        return listenerMethodDescriptors == null ? null
+                : listenerMethodDescriptors
+                        .toArray(new MethodDescriptor[listenerMethodDescriptors
+                                .size()]);
     }
 
     public Method getRemoveListenerMethod() {
@@ -308,27 +298,17 @@
         return inDefaultEventSet;
     }
 
-    
-    private static final String AWT_EVENT_PREFIX="java.awt.event.";
-    
-    private boolean checkMethod(Class<?> listenerType, Method listenerMethod)
-            throws IntrospectionException {
-        if (listenerMethod != null && listenerType != null &&    
-            !listenerMethod.getDeclaringClass().isAssignableFrom(listenerType)) {
-            throw new IntrospectionException(Messages.getString("beans.31", //$NON-NLS-1$
-                    listenerMethod.getName(), listenerType.getName()));
-        }
-        return true;
-    }
-
-        
     /**
-     * Searches for {add|remove}Listener methods in the event source.
-     * Parameter check is also performed.
-     * @param sourceClass event source class
-     * @param methodName method name to search
+     * Searches for {add|remove}Listener methods in the event source. Parameter
+     * check is also performed.
+     * 
+     * @param sourceClass
+     *            event source class
+     * @param methodName
+     *            method name to search
      * @return found method
-     * @throws IntrospectionException if no valid method found
+     * @throws IntrospectionException
+     *             if no valid method found
      */
     private Method findAddRemoveListenerMethod(Class<?> sourceClass,
             String methodName) throws IntrospectionException {
@@ -342,7 +322,7 @@
                     methodName, listenerType.getName()));
         }
     }
-    
+
     private Method findAddRemoveListnerMethodWithLessCheck(
             Class<?> sourceClass, String methodName, Class listenerTYpe)
             throws IntrospectionException {
@@ -355,17 +335,17 @@
             if (m.getName().equals(methodName)) {
                 Class[] paramTypes = m.getParameterTypes();
                 if (paramTypes.length == 1) {
-//                    String paramTypeName = paramTypes[0].getName();
-//                    paramTypeName = paramTypeName.substring(paramTypeName
-//                            .lastIndexOf(".") + 1);
-//                    if (paramTypeName.endsWith("Listener")) {
-//                        paramTypeName = paramTypeName.substring(0,
-//                                paramTypeName.length() - "Listener".length());
-//                        if (expectedListenerTypeName.startsWith(paramTypeName)) {
-                            method = m;
-                            break;
-//                        }
-//                    }
+                    // String paramTypeName = paramTypes[0].getName();
+                    // paramTypeName = paramTypeName.substring(paramTypeName
+                    // .lastIndexOf(".") + 1);
+                    // if (paramTypeName.endsWith("Listener")) {
+                    // paramTypeName = paramTypeName.substring(0,
+                    // paramTypeName.length() - "Listener".length());
+                    // if (expectedListenerTypeName.startsWith(paramTypeName)) {
+                    method = m;
+                    break;
+                    // }
+                    // }
                 }
             }
         }
@@ -384,8 +364,7 @@
      * @return found Method object for custom getListener or null if nothing is
      *         found
      */
-    private Method findGetListenerMethod(Class<?> sourceClass,
-            String methodName) {
+    private Method findGetListenerMethod(Class<?> sourceClass, String methodName) {
         try {
             return sourceClass.getMethod(methodName);
         } catch (Exception e) {
@@ -394,12 +373,12 @@
         }
     }
 
-    private Method findMethodByPrefix(Class<?> sourceClass,
-            String prefix, String postfix) {
+    private Method findMethodByPrefix(Class<?> sourceClass, String prefix,
+            String postfix) {
         String shortName = listenerType.getName();
-        if(listenerType.getPackage()!= null){
-            shortName = shortName.substring(
-                listenerType.getPackage().getName().length() + 1);
+        if (listenerType.getPackage() != null) {
+            shortName = shortName.substring(listenerType.getPackage().getName()
+                    .length() + 1);
         }
         String methodName = prefix + shortName + postfix;
         try {
@@ -410,8 +389,8 @@
             return null;
         }
         Method[] m = sourceClass.getMethods();
-        for(int i = 0; i < m.length; i++){
-            if(m[i].getName().equals(methodName)){
+        for (int i = 0; i < m.length; i++) {
+            if (m[i].getName().equals(methodName)) {
                 Class[] paramTypes = m[i].getParameterTypes();
                 if (paramTypes.length == 1) {
                     return m[i];

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java?view=diff&rev=557504&r1=557503&r2=557504
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java Wed Jul 18 23:30:02 2007
@@ -35,8 +35,8 @@
 
     boolean bound;
 
-    public PropertyDescriptor(String propertyName, Class<?> beanClass, String getterName,
-            String setterName) throws IntrospectionException {
+    public PropertyDescriptor(String propertyName, Class<?> beanClass,
+            String getterName, String setterName) throws IntrospectionException {
         super();
         if (beanClass == null) {
             throw new IntrospectionException(Messages.getString("beans.03")); //$NON-NLS-1$
@@ -46,18 +46,21 @@
         }
         this.setName(propertyName);
         if (getterName != null) {
-            if(getterName.length() == 0){
-                throw new IntrospectionException("read or write method cannot be empty."); //$NON-NLS-1$    
+            if (getterName.length() == 0) {
+                throw new IntrospectionException(
+                        "read or write method cannot be empty."); //$NON-NLS-1$    
             }
-            try{
+            try {
                 setReadMethod(beanClass, getterName);
-            }catch(IntrospectionException e){
-                setReadMethod(beanClass, createDefaultMethodName(propertyName, "get")); //$NON-NLS-1$
+            } catch (IntrospectionException e) {
+                setReadMethod(beanClass, createDefaultMethodName(propertyName,
+                        "get")); //$NON-NLS-1$
             }
         }
         if (setterName != null) {
-            if(setterName.length() == 0){
-                throw new IntrospectionException("read or write method cannot be empty."); //$NON-NLS-1$    
+            if (setterName.length() == 0) {
+                throw new IntrospectionException(
+                        "read or write method cannot be empty."); //$NON-NLS-1$    
             }
             setWriteMethod(beanClass, setterName);
         }
@@ -84,11 +87,13 @@
         }
         this.setName(propertyName);
         try {
-            setReadMethod(beanClass, createDefaultMethodName(propertyName, "is")); //$NON-NLS-1$
+            setReadMethod(beanClass,
+                    createDefaultMethodName(propertyName, "is")); //$NON-NLS-1$
         } catch (Exception e) {
-            setReadMethod(beanClass, createDefaultMethodName(propertyName, "get")); //$NON-NLS-1$
+            setReadMethod(beanClass, createDefaultMethodName(propertyName,
+                    "get")); //$NON-NLS-1$
         }
-        
+
         setWriteMethod(beanClass, createDefaultMethodName(propertyName, "set")); //$NON-NLS-1$
     }
 
@@ -146,22 +151,26 @@
         boolean result = object instanceof PropertyDescriptor;
         if (result) {
             PropertyDescriptor pd = (PropertyDescriptor) object;
-            boolean gettersAreEqual = (this.getter == null) && (pd.getReadMethod() == null)
-                    || (this.getter != null) && (this.getter.equals(pd.getReadMethod()));
-            boolean settersAreEqual = (this.setter == null) && (pd.getWriteMethod() == null)
-                    || (this.setter != null) && (this.setter.equals(pd.getWriteMethod()));
-            boolean propertyTypesAreEqual = this.getPropertyType() == pd.getPropertyType();
-            boolean propertyEditorClassesAreEqual = this.getPropertyEditorClass() == pd
-                    .getPropertyEditorClass();
+            boolean gettersAreEqual = (this.getter == null)
+                    && (pd.getReadMethod() == null) || (this.getter != null)
+                    && (this.getter.equals(pd.getReadMethod()));
+            boolean settersAreEqual = (this.setter == null)
+                    && (pd.getWriteMethod() == null) || (this.setter != null)
+                    && (this.setter.equals(pd.getWriteMethod()));
+            boolean propertyTypesAreEqual = this.getPropertyType() == pd
+                    .getPropertyType();
+            boolean propertyEditorClassesAreEqual = this
+                    .getPropertyEditorClass() == pd.getPropertyEditorClass();
             boolean boundPropertyAreEqual = this.isBound() == pd.isBound();
-            boolean constrainedPropertyAreEqual = this.isConstrained() == pd.isConstrained();
-            result = gettersAreEqual && settersAreEqual && propertyTypesAreEqual
-                    && propertyEditorClassesAreEqual && boundPropertyAreEqual
-                    && constrainedPropertyAreEqual;
+            boolean constrainedPropertyAreEqual = this.isConstrained() == pd
+                    .isConstrained();
+            result = gettersAreEqual && settersAreEqual
+                    && propertyTypesAreEqual && propertyEditorClassesAreEqual
+                    && boundPropertyAreEqual && constrainedPropertyAreEqual;
         }
         return result;
     }
-    
+
     @Override
     public int hashCode() {
         return BeansUtils.getHashCode(getter) + BeansUtils.getHashCode(setter)
@@ -216,24 +225,27 @@
         return result;
     }
 
-    void setReadMethod(Class<?> beanClass, String getterName) throws IntrospectionException {
+    void setReadMethod(Class<?> beanClass, String getterName)
+            throws IntrospectionException {
         try {
-            Method readMethod = beanClass.getMethod(getterName, new Class[]{});
+            Method readMethod = beanClass.getMethod(getterName, new Class[] {});
             setReadMethod(readMethod);
         } catch (Exception e) {
             throw new IntrospectionException(e.getLocalizedMessage());
         }
     }
 
-    void setWriteMethod(Class<?> beanClass, String setterName) throws IntrospectionException {
+    void setWriteMethod(Class<?> beanClass, String setterName)
+            throws IntrospectionException {
         Method writeMethod = null;
         try {
-            if(getter != null){
-                writeMethod = beanClass.getMethod(setterName, new Class[]{getter.getReturnType()});
-            }else{
+            if (getter != null) {
+                writeMethod = beanClass.getMethod(setterName,
+                        new Class[] { getter.getReturnType() });
+            } else {
                 Method[] methods = beanClass.getMethods();
                 for (Method method : methods) {
-                    if(method.getName().equals(setterName)){
+                    if (method.getName().equals(setterName)) {
                         writeMethod = method;
                         break;
                     }
@@ -268,7 +280,8 @@
             }
         } catch (Exception e) {
             // beans.47=Unable to instantiate property editor
-            RuntimeException re = new RuntimeException(Messages.getString("beans.47"), e); //$NON-NLS-1$
+            RuntimeException re = new RuntimeException(Messages
+                    .getString("beans.47"), e); //$NON-NLS-1$
             throw re;
         }
         return editor;

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java?view=diff&rev=557504&r1=557503&r2=557504
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java Wed Jul 18 23:30:02 2007
@@ -55,11 +55,11 @@
 
     private BeanInfo explicitBeanInfo = null;
 
-	private EventSetDescriptor[] events = null;
+    private EventSetDescriptor[] events = null;
 
-	private MethodDescriptor[] methods = null;
+    private MethodDescriptor[] methods = null;
 
-	private PropertyDescriptor[] properties = null;
+    private PropertyDescriptor[] properties = null;
 
     BeanInfo[] additionalBeanInfo = null;
 
@@ -73,10 +73,11 @@
 
     private Image[] icon = new Image[4];
 
-	private boolean canAddPropertyChangeListener;
+    private boolean canAddPropertyChangeListener;
 
-	private boolean canRemovePropertyChangeListener;
-	StandardBeanInfo(Class beanClass, BeanInfo explicitBeanInfo, Class stopClass)
+    private boolean canRemovePropertyChangeListener;
+
+    StandardBeanInfo(Class beanClass, BeanInfo explicitBeanInfo, Class stopClass)
             throws IntrospectionException {
         assert (beanClass != null);
         this.beanClass = beanClass;
@@ -102,15 +103,15 @@
             events = explicitBeanInfo.getEventSetDescriptors();
             methods = explicitBeanInfo.getMethodDescriptors();
             properties = explicitBeanInfo.getPropertyDescriptors();
-			defaultEventIndex = explicitBeanInfo.getDefaultEventIndex();
-			if (defaultEventIndex < 0 || defaultEventIndex >= events.length) {
-				defaultEventIndex = -1;
-			}
-			defaultPropertyIndex = explicitBeanInfo.getDefaultPropertyIndex();
-			if (defaultPropertyIndex < 0
-					|| defaultPropertyIndex >= properties.length) {
-				defaultPropertyIndex = -1;
-			}
+            defaultEventIndex = explicitBeanInfo.getDefaultEventIndex();
+            if (defaultEventIndex < 0 || defaultEventIndex >= events.length) {
+                defaultEventIndex = -1;
+            }
+            defaultPropertyIndex = explicitBeanInfo.getDefaultPropertyIndex();
+            if (defaultPropertyIndex < 0
+                    || defaultPropertyIndex >= properties.length) {
+                defaultPropertyIndex = -1;
+            }
             additionalBeanInfo = explicitBeanInfo.getAdditionalBeanInfo();
             for (int i = 0; i < 4; i++) {
                 icon[i] = explicitBeanInfo.getIcon(i + 1);
@@ -124,17 +125,17 @@
                 explicitProperties = true;
         }
 
-		if (methods == null) {
-			methods = introspectMethods();
-		}
-
-		if (properties == null) {
-			properties = introspectProperties(stopClass);
-		}
-
-		if (events == null) {
-			events = introspectEvents();
-		}
+        if (methods == null) {
+            methods = introspectMethods();
+        }
+
+        if (properties == null) {
+            properties = introspectProperties(stopClass);
+        }
+
+        if (events == null) {
+            events = introspectEvents();
+        }
     }
 
     public BeanInfo[] getAdditionalBeanInfo() {
@@ -149,9 +150,9 @@
         return methods;
     }
 
-	public PropertyDescriptor[] getPropertyDescriptors() {
-		return properties;
-	}
+    public PropertyDescriptor[] getPropertyDescriptors() {
+        return properties;
+    }
 
     public BeanDescriptor getBeanDescriptor() {
         if (explicitBeanInfo != null) {
@@ -175,61 +176,62 @@
         return icon[iconKind - 1];
     }
 
-	void mergeBeanInfo(BeanInfo beanInfo, boolean force)
-			throws IntrospectionException {
-		if (force || !explicitProperties) {
-			PropertyDescriptor[] superDescs = beanInfo.getPropertyDescriptors();
-			if (superDescs != null) {
-				if (getPropertyDescriptors() != null) {
-					properties = mergeProps(superDescs, beanInfo
-							.getDefaultPropertyIndex());
-				} else {
-					properties = superDescs;
-					defaultPropertyIndex = beanInfo.getDefaultPropertyIndex();
-				}
-			}
-		}
-
-		if (force || !explicitMethods) {
-			MethodDescriptor[] superMethods = beanInfo.getMethodDescriptors();
-			if (superMethods != null) {
-				if (methods != null) {
-					methods = mergeMethods(superMethods);
-				} else {
-					methods = superMethods;
-				}
-			}
-		}
-
-		if (force || !explicitEvents) {
-			EventSetDescriptor[] superEvents = beanInfo
-					.getEventSetDescriptors();
-			if (superEvents != null) {
-				if (events != null) {
-					events = mergeEvents(superEvents, beanInfo
-							.getDefaultEventIndex());
-				} else {
-					events = superEvents;
-					defaultEventIndex = beanInfo.getDefaultEventIndex();
-				}
-			}
-		}
-	}
+    void mergeBeanInfo(BeanInfo beanInfo, boolean force)
+            throws IntrospectionException {
+        if (force || !explicitProperties) {
+            PropertyDescriptor[] superDescs = beanInfo.getPropertyDescriptors();
+            if (superDescs != null) {
+                if (getPropertyDescriptors() != null) {
+                    properties = mergeProps(superDescs, beanInfo
+                            .getDefaultPropertyIndex());
+                } else {
+                    properties = superDescs;
+                    defaultPropertyIndex = beanInfo.getDefaultPropertyIndex();
+                }
+            }
+        }
+
+        if (force || !explicitMethods) {
+            MethodDescriptor[] superMethods = beanInfo.getMethodDescriptors();
+            if (superMethods != null) {
+                if (methods != null) {
+                    methods = mergeMethods(superMethods);
+                } else {
+                    methods = superMethods;
+                }
+            }
+        }
+
+        if (force || !explicitEvents) {
+            EventSetDescriptor[] superEvents = beanInfo
+                    .getEventSetDescriptors();
+            if (superEvents != null) {
+                if (events != null) {
+                    events = mergeEvents(superEvents, beanInfo
+                            .getDefaultEventIndex());
+                } else {
+                    events = superEvents;
+                    defaultEventIndex = beanInfo.getDefaultEventIndex();
+                }
+            }
+        }
+    }
+
     /*
      * merge the PropertyDescriptor with superclass
      */
-	private PropertyDescriptor[] mergeProps(PropertyDescriptor[] superDescs,
-			int superDefaultIndex) throws IntrospectionException {
-		// FIXME:change to OO way as EventSetD and MethodD
-		HashMap<String, PropertyDescriptor> subMap = internalAsMap(properties);
-		String defaultPropertyName = null;
-		if (defaultPropertyIndex >= 0
-				&& defaultPropertyIndex < properties.length) {
-			defaultPropertyName = properties[defaultPropertyIndex].getName();
-		} else if (superDefaultIndex >= 0
-				&& superDefaultIndex < superDescs.length) {
-			defaultPropertyName = superDescs[superDefaultIndex].getName();
-		}
+    private PropertyDescriptor[] mergeProps(PropertyDescriptor[] superDescs,
+            int superDefaultIndex) throws IntrospectionException {
+        // FIXME:change to OO way as EventSetD and MethodD
+        HashMap<String, PropertyDescriptor> subMap = internalAsMap(properties);
+        String defaultPropertyName = null;
+        if (defaultPropertyIndex >= 0
+                && defaultPropertyIndex < properties.length) {
+            defaultPropertyName = properties[defaultPropertyIndex].getName();
+        } else if (superDefaultIndex >= 0
+                && superDefaultIndex < superDescs.length) {
+            defaultPropertyName = superDescs[superDefaultIndex].getName();
+        }
 
         for (int i = 0; i < superDescs.length; i++) {
             PropertyDescriptor superDesc = superDescs[i];
@@ -343,90 +345,90 @@
         PropertyDescriptor[] theDescs = new PropertyDescriptor[subMap.size()];
         subMap.values().toArray(theDescs);
 
-		if (defaultPropertyName != null && !explicitProperties) {
-			for (int i = 0; i < theDescs.length; i++) {
-				if (defaultPropertyName.equals(theDescs[i].getName())) {
-					defaultPropertyIndex = i;
-					break;
-				}
-			}
-		}
+        if (defaultPropertyName != null && !explicitProperties) {
+            for (int i = 0; i < theDescs.length; i++) {
+                if (defaultPropertyName.equals(theDescs[i].getName())) {
+                    defaultPropertyIndex = i;
+                    break;
+                }
+            }
+        }
         return theDescs;
     }
 
-	private static void mergeAttributes(PropertyDescriptor subDesc,
-			PropertyDescriptor superDesc) {
-		// FIXME: this is just temp workaround, need more elegant solution to
-		// handle this
-		subDesc.hidden |= superDesc.hidden;
-		subDesc.expert |= superDesc.expert;
-		subDesc.preferred |= superDesc.preferred;
-		subDesc.bound |= superDesc.bound;
-		subDesc.constrained |= superDesc.constrained;
-		subDesc.name = superDesc.name;
-		if (subDesc.shortDescription == null
-				&& superDesc.shortDescription != null) {
-			subDesc.shortDescription = superDesc.shortDescription;
-		}
-		if (subDesc.displayName == null && superDesc.displayName != null) {
-			subDesc.displayName = superDesc.displayName;
-		}
-	}
+    private static void mergeAttributes(PropertyDescriptor subDesc,
+            PropertyDescriptor superDesc) {
+        // FIXME: this is just temp workaround, need more elegant solution to
+        // handle this
+        subDesc.hidden |= superDesc.hidden;
+        subDesc.expert |= superDesc.expert;
+        subDesc.preferred |= superDesc.preferred;
+        subDesc.bound |= superDesc.bound;
+        subDesc.constrained |= superDesc.constrained;
+        subDesc.name = superDesc.name;
+        if (subDesc.shortDescription == null
+                && superDesc.shortDescription != null) {
+            subDesc.shortDescription = superDesc.shortDescription;
+        }
+        if (subDesc.displayName == null && superDesc.displayName != null) {
+            subDesc.displayName = superDesc.displayName;
+        }
+    }
 
     /*
      * merge the MethodDescriptor
      */
-	private MethodDescriptor[] mergeMethods(MethodDescriptor[] superDescs) {
-		HashMap<String, MethodDescriptor> subMap = internalAsMap(methods);
+    private MethodDescriptor[] mergeMethods(MethodDescriptor[] superDescs) {
+        HashMap<String, MethodDescriptor> subMap = internalAsMap(methods);
 
-		for (MethodDescriptor superMethod : superDescs) {
-			String methodName = getQualifiedName(superMethod.getMethod());
-			MethodDescriptor method = subMap.get(methodName);
-			if (method == null) {
-				subMap.put(methodName, superMethod);
-			} else {
-				method.merge(superMethod);
-			}
-		}
-		MethodDescriptor[] theMethods = new MethodDescriptor[subMap.size()];
-		subMap.values().toArray(theMethods);
-		return theMethods;
-	}
-
-	private EventSetDescriptor[] mergeEvents(EventSetDescriptor[] otherEvents,
-			int otherDefaultIndex) {
-		HashMap<String, EventSetDescriptor> subMap = internalAsMap(events);
-		String defaultEventName = null;
-		if (defaultEventIndex >= 0 && defaultEventIndex < events.length) {
-			defaultEventName = events[defaultEventIndex].getName();
-		} else if (otherDefaultIndex >= 0
-				&& otherDefaultIndex < otherEvents.length) {
-			defaultEventName = otherEvents[otherDefaultIndex].getName();
-		}
-
-		for (EventSetDescriptor event : otherEvents) {
-			String eventName = event.getName();
-			EventSetDescriptor subEvent = subMap.get(eventName);
-			if (subEvent == null) {
-				subMap.put(eventName, event);
-			} else {
-				subEvent.merge(event);
-			}
-		}
-
-		EventSetDescriptor[] theEvents = new EventSetDescriptor[subMap.size()];
-		subMap.values().toArray(theEvents);
-
-		if (defaultEventName != null && !explicitEvents) {
-			for (int i = 0; i < theEvents.length; i++) {
-				if (defaultEventName.equals(theEvents[i].getName())) {
-					defaultEventIndex = i;
-					break;
-				}
-			}
-		}
-		return theEvents;
-	}
+        for (MethodDescriptor superMethod : superDescs) {
+            String methodName = getQualifiedName(superMethod.getMethod());
+            MethodDescriptor method = subMap.get(methodName);
+            if (method == null) {
+                subMap.put(methodName, superMethod);
+            } else {
+                method.merge(superMethod);
+            }
+        }
+        MethodDescriptor[] theMethods = new MethodDescriptor[subMap.size()];
+        subMap.values().toArray(theMethods);
+        return theMethods;
+    }
+
+    private EventSetDescriptor[] mergeEvents(EventSetDescriptor[] otherEvents,
+            int otherDefaultIndex) {
+        HashMap<String, EventSetDescriptor> subMap = internalAsMap(events);
+        String defaultEventName = null;
+        if (defaultEventIndex >= 0 && defaultEventIndex < events.length) {
+            defaultEventName = events[defaultEventIndex].getName();
+        } else if (otherDefaultIndex >= 0
+                && otherDefaultIndex < otherEvents.length) {
+            defaultEventName = otherEvents[otherDefaultIndex].getName();
+        }
+
+        for (EventSetDescriptor event : otherEvents) {
+            String eventName = event.getName();
+            EventSetDescriptor subEvent = subMap.get(eventName);
+            if (subEvent == null) {
+                subMap.put(eventName, event);
+            } else {
+                subEvent.merge(event);
+            }
+        }
+
+        EventSetDescriptor[] theEvents = new EventSetDescriptor[subMap.size()];
+        subMap.values().toArray(theEvents);
+
+        if (defaultEventName != null && !explicitEvents) {
+            for (int i = 0; i < theEvents.length; i++) {
+                if (defaultEventName.equals(theEvents[i].getName())) {
+                    defaultEventIndex = i;
+                    break;
+                }
+            }
+        }
+        return theEvents;
+    }
 
     private static HashMap<String, PropertyDescriptor> internalAsMap(
             PropertyDescriptor[] propertyDescs) {
@@ -476,20 +478,20 @@
      * @return An array of MethodDescriptors with the public methods. null if
      *         there are no public methods
      */
-	private MethodDescriptor[] introspectMethods() {
-		return introspectMethods(false, beanClass);
-	}
-
-	private MethodDescriptor[] introspectMethods(boolean includeSuper) {
-		return introspectMethods(includeSuper, beanClass);
-	}
-
-	private MethodDescriptor[] introspectMethods(boolean includeSuper,
-			Class introspectorClass) {
-
-		// Get the list of methods belonging to this class
-		Method[] basicMethods = includeSuper ? introspectorClass.getMethods()
-				: introspectorClass.getDeclaredMethods();
+    private MethodDescriptor[] introspectMethods() {
+        return introspectMethods(false, beanClass);
+    }
+
+    private MethodDescriptor[] introspectMethods(boolean includeSuper) {
+        return introspectMethods(includeSuper, beanClass);
+    }
+
+    private MethodDescriptor[] introspectMethods(boolean includeSuper,
+            Class introspectorClass) {
+
+        // Get the list of methods belonging to this class
+        Method[] basicMethods = includeSuper ? introspectorClass.getMethods()
+                : introspectorClass.getDeclaredMethods();
 
         if (basicMethods == null || basicMethods.length == 0)
             return null;
@@ -510,7 +512,7 @@
 
         // Get the list of public methods into the returned array
         int methodCount = methodList.size();
-		MethodDescriptor[] theMethods = null;
+        MethodDescriptor[] theMethods = null;
         if (methodCount > 0) {
             theMethods = new MethodDescriptor[methodCount];
             theMethods = (MethodDescriptor[]) methodList.toArray(theMethods);
@@ -528,11 +530,11 @@
      * @return The list of Properties as an array of PropertyDescriptors
      * @throws IntrospectionException
      */
-	private PropertyDescriptor[] introspectProperties(Class stopClass)
-			throws IntrospectionException {
+    private PropertyDescriptor[] introspectProperties(Class stopClass)
+            throws IntrospectionException {
 
         // Get descriptors for the public methods
-		MethodDescriptor[] theMethods = introspectMethods();
+        MethodDescriptor[] theMethods = introspectMethods();
 
         if (theMethods == null)
             return null;
@@ -546,25 +548,25 @@
             introspectSet(theMethods[i].getMethod(), propertyTable);
         }
 
-		// If there are listener methods, should be bound.
-		MethodDescriptor[] allMethods = introspectMethods(true);
-		if (stopClass != null) {
-			MethodDescriptor[] excludeMethods = introspectMethods(true,
-					stopClass);
-			if (excludeMethods != null) {
-				ArrayList<MethodDescriptor> tempMethods = new ArrayList<MethodDescriptor>();
-				for (MethodDescriptor method : allMethods) {
-					if(!isInSuper(method, excludeMethods)){
-						tempMethods.add(method);
-					}
-				}
-				allMethods = (MethodDescriptor[]) tempMethods
-						.toArray(new MethodDescriptor[0]);
-			}
-		}
-		for (int i = 0; i < allMethods.length; i++) {
-			introspectPropertyListener(allMethods[i].getMethod());
-		}
+        // If there are listener methods, should be bound.
+        MethodDescriptor[] allMethods = introspectMethods(true);
+        if (stopClass != null) {
+            MethodDescriptor[] excludeMethods = introspectMethods(true,
+                    stopClass);
+            if (excludeMethods != null) {
+                ArrayList<MethodDescriptor> tempMethods = new ArrayList<MethodDescriptor>();
+                for (MethodDescriptor method : allMethods) {
+                    if (!isInSuper(method, excludeMethods)) {
+                        tempMethods.add(method);
+                    }
+                }
+                allMethods = (MethodDescriptor[]) tempMethods
+                        .toArray(new MethodDescriptor[0]);
+            }
+        }
+        for (int i = 0; i < allMethods.length; i++) {
+            introspectPropertyListener(allMethods[i].getMethod());
+        }
         // Put the properties found into the PropertyDescriptor array
         ArrayList<PropertyDescriptor> propertyList = new ArrayList<PropertyDescriptor>();
 
@@ -602,16 +604,16 @@
                 }
             }
             // RI set propretyDescriptor as bound. FIXME
-			// propertyDesc.setBound(true);
-			if (canAddPropertyChangeListener && canRemovePropertyChangeListener) {
-				propertyDesc.setBound(true);
-			} else {
-				propertyDesc.setBound(false);
-			}
-			if (table.get("isConstrained") == Boolean.TRUE) {
-				propertyDesc.setConstrained(true);
-			}
-			propertyList.add(propertyDesc);
+            // propertyDesc.setBound(true);
+            if (canAddPropertyChangeListener && canRemovePropertyChangeListener) {
+                propertyDesc.setBound(true);
+            } else {
+                propertyDesc.setBound(false);
+            }
+            if (table.get("isConstrained") == Boolean.TRUE) {
+                propertyDesc.setConstrained(true);
+            }
+            propertyList.add(propertyDesc);
         }
 
         PropertyDescriptor[] theProperties = new PropertyDescriptor[propertyList
@@ -620,29 +622,31 @@
         return theProperties;
     }
 
-	private boolean isInSuper(MethodDescriptor method,
-			MethodDescriptor[] excludeMethods) {
-		for (MethodDescriptor m : excludeMethods) {
-			if (method.getMethod().equals(m.getMethod())) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	private void introspectPropertyListener(Method theMethod) {
-		String methodName = theMethod.getName();
-		Class[] param = theMethod.getParameterTypes();
-		if (param.length != 1) {
-			return;
-		}
-		if (methodName.equals("addPropertyChangeListener")
-				&& param[0].equals(PropertyChangeListener.class))
-			canAddPropertyChangeListener = true;
-		if (methodName.equals("removePropertyChangeListener")
-				&& param[0].equals(PropertyChangeListener.class))
-			canRemovePropertyChangeListener = true;
-	}
+    private boolean isInSuper(MethodDescriptor method,
+            MethodDescriptor[] excludeMethods) {
+        for (MethodDescriptor m : excludeMethods) {
+            if (method.getMethod().equals(m.getMethod())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private void introspectPropertyListener(Method theMethod) {
+        String methodName = theMethod.getName();
+        Class[] param = theMethod.getParameterTypes();
+        if (param.length != 1) {
+            return;
+        }
+        if (methodName.equals("addPropertyChangeListener")
+                && param[0].equals(PropertyChangeListener.class))
+            canAddPropertyChangeListener = true;
+        if (methodName.equals("removePropertyChangeListener")
+                && param[0].equals(PropertyChangeListener.class))
+            canRemovePropertyChangeListener = true;
+    }
+
+    @SuppressWarnings("unchecked")
     private static void introspectGet(Method theMethod,
             HashMap<String, HashMap> propertyTable) {
         String methodName = theMethod.getName();
@@ -790,14 +794,13 @@
         table.put(tag + "set", theMethod); //$NON-NLS-1$
         table.put(tag + "PropertyType", propertyType); //$NON-NLS-1$
 
-		// handle constrained
-		boolean isConstrained = false;
-		Class[] exceptions = theMethod.getExceptionTypes();
-		for (Class e : exceptions) {
-			if (e.equals(PropertyVetoException.class)) {
-				table.put("isConstrained", Boolean.TRUE);
-			}
-		}
+        // handle constrained
+        Class[] exceptions = theMethod.getExceptionTypes();
+        for (Class e : exceptions) {
+            if (e.equals(PropertyVetoException.class)) {
+                table.put("isConstrained", Boolean.TRUE);
+            }
+        }
         propertyTable.put(propertyName, table);
     }
 
@@ -809,11 +812,11 @@
      * @return the events
      * @throws IntrospectionException
      */
-	private EventSetDescriptor[] introspectEvents()
-			throws IntrospectionException {
-		// Get descriptors for the public methods
-		// FIXME: performance
-		MethodDescriptor[] theMethods = introspectMethods();
+    private EventSetDescriptor[] introspectEvents()
+            throws IntrospectionException {
+        // Get descriptors for the public methods
+        // FIXME: performance
+        MethodDescriptor[] theMethods = introspectMethods();
 
         if (theMethods == null)
             return null;
@@ -995,37 +998,37 @@
         return (propertyName != null) && (propertyName.length() != 0);
     }
 
-	private static class PropertyComparator implements
-			Comparator<PropertyDescriptor> {
-		public int compare(PropertyDescriptor object1,
-				PropertyDescriptor object2) {
-			return object1.getName().compareTo(object2.getName());
-		}
-
-	}
-
-	// TODO
-	void init() {
-		if (this.events == null) {
-			events = new EventSetDescriptor[0];
-		}
-		if (this.properties == null) {
-			this.properties = new PropertyDescriptor[0];
-		}
-
-		if (properties != null) {
-			String defaultPropertyName = (defaultPropertyIndex != -1 ? properties[defaultPropertyIndex]
-					.getName()
-					: null);
-			Arrays.sort(properties, comparator);
-			if (null != defaultPropertyName) {
-				for (int i = 0; i < properties.length; i++) {
-					if (defaultPropertyName.equals(properties[i].getName())) {
-						defaultPropertyIndex = i;
-						break;
-					}
-				}
-			}
-		}
-	}
+    private static class PropertyComparator implements
+            Comparator<PropertyDescriptor> {
+        public int compare(PropertyDescriptor object1,
+                PropertyDescriptor object2) {
+            return object1.getName().compareTo(object2.getName());
+        }
+
+    }
+
+    // TODO
+    void init() {
+        if (this.events == null) {
+            events = new EventSetDescriptor[0];
+        }
+        if (this.properties == null) {
+            this.properties = new PropertyDescriptor[0];
+        }
+
+        if (properties != null) {
+            String defaultPropertyName = (defaultPropertyIndex != -1 ? properties[defaultPropertyIndex]
+                    .getName()
+                    : null);
+            Arrays.sort(properties, comparator);
+            if (null != defaultPropertyName) {
+                for (int i = 0; i < properties.length; i++) {
+                    if (defaultPropertyName.equals(properties[i].getName())) {
+                        defaultPropertyIndex = i;
+                        break;
+                    }
+                }
+            }
+        }
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java?view=diff&rev=557504&r1=557503&r2=557504
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java Wed Jul 18 23:30:02 2007
@@ -26,19 +26,17 @@
 import java.util.Iterator;
 import java.util.List;
 
-//FIXME: obviously need synchronization, when access listeners
+// FIXME: obviously need synchronization, when access listeners
 
 public class VetoableChangeSupport implements Serializable {
 
     private static final long serialVersionUID = -5090210921595982017l;
 
     private Hashtable<String, VetoableChangeSupport> children = new Hashtable<String, VetoableChangeSupport>();
-    
+
     private transient ArrayList<VetoableChangeListener> globalListeners = new ArrayList<VetoableChangeListener>();
-    
-    private Object source;
 
-    private int vetoableChangeSupportSerializedDataVersion = 2;
+    private Object source;
 
     public VetoableChangeSupport(Object sourceBean) {
         if (sourceBean == null) {
@@ -50,8 +48,7 @@
     public synchronized void removeVetoableChangeListener(String propertyName,
             VetoableChangeListener listener) {
         if ((propertyName != null) && (listener != null)) {
-            VetoableChangeSupport listeners = children
-                    .get(propertyName);
+            VetoableChangeSupport listeners = children.get(propertyName);
 
             if (listeners != null) {
                 listeners.removeVetoableChangeListener(listener);
@@ -62,8 +59,7 @@
     public synchronized void addVetoableChangeListener(String propertyName,
             VetoableChangeListener listener) {
         if (propertyName != null && listener != null) {
-            VetoableChangeSupport listeners = children
-                    .get(propertyName);
+            VetoableChangeSupport listeners = children.get(propertyName);
 
             if (listeners == null) {
                 listeners = new VetoableChangeSupport(source);
@@ -87,8 +83,7 @@
     public synchronized boolean hasListeners(String propertyName) {
         boolean result = globalListeners.size() > 0;
         if (!result && propertyName != null) {
-            VetoableChangeSupport listeners = children
-                    .get(propertyName);
+            VetoableChangeSupport listeners = children.get(propertyName);
             if (listeners != null) {
                 result = listeners.globalListeners.size() > 0;
             }
@@ -105,7 +100,7 @@
 
     public synchronized void addVetoableChangeListener(
             VetoableChangeListener listener) {
-        if(listener != null){
+        if (listener != null) {
             if (listener instanceof VetoableChangeListenerProxy) {
                 VetoableChangeListenerProxy proxy = (VetoableChangeListenerProxy) listener;
                 addVetoableChangeListener(proxy.getPropertyName(),
@@ -140,7 +135,8 @@
 
     private void writeObject(ObjectOutputStream oos) throws IOException {
         oos.defaultWriteObject();
-        VetoableChangeListener[] copy = new VetoableChangeListener[globalListeners.size()];
+        VetoableChangeListener[] copy = new VetoableChangeListener[globalListeners
+                .size()];
         globalListeners.toArray(copy);
         for (VetoableChangeListener listener : copy) {
             if (listener instanceof Serializable) {
@@ -152,7 +148,6 @@
 
     }
 
-    
     private void readObject(ObjectInputStream ois) throws IOException,
             ClassNotFoundException {
         ois.defaultReadObject();
@@ -167,7 +162,7 @@
             addVetoableChangeListener((VetoableChangeListener) listener);
         } while (listener != null);
     }
-    
+
     public void fireVetoableChange(String propertyName, boolean oldValue,
             boolean newValue) throws PropertyVetoException {
         PropertyChangeEvent event = createPropertyChangeEvent(propertyName,
@@ -181,14 +176,14 @@
                 oldValue, newValue);
         doFirePropertyChange(event);
     }
-    
+
     public void fireVetoableChange(String propertyName, Object oldValue,
             Object newValue) throws PropertyVetoException {
         PropertyChangeEvent event = createPropertyChangeEvent(propertyName,
                 oldValue, newValue);
         doFirePropertyChange(event);
     }
-    
+
     public void fireVetoableChange(PropertyChangeEvent event)
             throws PropertyVetoException {
         doFirePropertyChange(event);
@@ -196,8 +191,7 @@
 
     private PropertyChangeEvent createPropertyChangeEvent(String propertyName,
             Object oldValue, Object newValue) {
-        return new PropertyChangeEvent(source, propertyName, oldValue,
-                newValue);
+        return new PropertyChangeEvent(source, propertyName, oldValue, newValue);
     }
 
     private void doFirePropertyChange(PropertyChangeEvent event)
@@ -219,7 +213,7 @@
             listensToAll = globalListeners
                     .toArray(new VetoableChangeListener[0]);
             String propertyName = event.getPropertyName();
-            if(propertyName != null){
+            if (propertyName != null) {
                 listeners = children.get(propertyName);
             }
         }
@@ -240,7 +234,7 @@
             }
             throw pve;
         }
-        if(listeners != null){
+        if (listeners != null) {
             listeners.fireVetoableChange(event);
         }
     }



Mime
View raw message