harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r418239 [1/2] - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans: BeanDescriptor.java BeanInfoImpl.java BeanInfoWrapper.java Beans.java DefaultPersistenceDelegate.java XMLDecoder.java XMLEncoder.java
Date Fri, 30 Jun 2006 11:20:23 GMT
Author: mloenko
Date: Fri Jun 30 04:20:22 2006
New Revision: 418239

URL: http://svn.apache.org/viewvc?rev=418239&view=rev
Log:
applied patch from HARMONY-711 
[classlib][beans] beautifying of several java.beans classes
then applied automatic formatter

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLEncoder.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java?rev=418239&r1=418238&r2=418239&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java Fri Jun 30 04:20:22 2006
@@ -23,6 +23,7 @@
  * @author Maxim V. Berkultsev
  */
 public class BeanDescriptor extends FeatureDescriptor {
+
     private Class<?> beanClass;
 
     private Class<?> customizerClass;
@@ -102,6 +103,7 @@
         if (beanClass != null) {
             String beanClassName = beanClass.getName();
             int idx = beanClassName.lastIndexOf(".");
+
             result = (idx == -1) ? beanClassName : beanClassName
                     .substring(idx + 1);
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java?rev=418239&r1=418238&r2=418239&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java Fri Jun 30 04:20:22 2006
@@ -30,10 +30,15 @@
 class BeanInfoImpl implements BeanInfo {
 
     private static int MT_OTHER = 0;
+
     private static int MT_SETTER = 1;
+
     private static int MT_GETTER = 2;
+
     private static int MT_BOOLEAN_GETTER = 3;
+
     private static int MT_INDEXED_SETTER = 4;
+
     private static int MT_INDEXED_GETTER = 5;
 
     public BeanInfoImpl(Class<?> beanClass) {
@@ -43,21 +48,25 @@
     public PropertyDescriptor[] getPropertyDescriptors() {
         if (propertyDescriptors == null) {
             HashMap<String, PropertyDescriptor> result = new HashMap<String, PropertyDescriptor>();
-            
+
             if (beanClass != null) {
                 List<Method> beanClassMethodsArrayList = getPublicMethods(beanClass);
-                
+
                 ArrayList<Method> setters = new ArrayList<Method>();
                 ArrayList<Method> getters = new ArrayList<Method>();
                 ArrayList<Method> booleanGetters = new ArrayList<Method>();
                 ArrayList<Method> indexedSetters = new ArrayList<Method>();
                 ArrayList<Method> indexedGetters = new ArrayList<Method>();
-                
-                Iterator<Method> iterator = beanClassMethodsArrayList.iterator();
+
+                Iterator<Method> iterator = beanClassMethodsArrayList
+                        .iterator();
+                Object[] values;
+
                 while (iterator.hasNext()) {
                     Method method = (Method) iterator.next();
-                    
+
                     int methodType = getMethodType(method);
+
                     if (methodType == MT_SETTER) {
                         setters.add(method);
                     } else if (methodType == MT_GETTER) {
@@ -75,97 +84,100 @@
                             indexedGetters, false);
                     addIndexedPropertyDescriptorsFromMethodList(result,
                             indexedSetters, true);
-                    addPropertyDescriptorsFromMethodList(result, booleanGetters,
-                            false);
+                    addPropertyDescriptorsFromMethodList(result,
+                            booleanGetters, false);
                     addPropertyDescriptorsFromMethodList(result, setters, true);
                     addPropertyDescriptorsFromMethodList(result, getters, true);
-                } catch (Exception e) {
-                }
-                
-                Object[] values = result.values().toArray();
+                } catch (Exception e) {}
+
+                values = result.values().toArray();
                 propertyDescriptors = new PropertyDescriptor[values.length];
-                for(int k = 0; k < propertyDescriptors.length; ++k) {
+                for (int k = 0; k < propertyDescriptors.length; ++k) {
                     propertyDescriptors[k] = (PropertyDescriptor) values[k];
                 }
             }
         }
-        
+
         return propertyDescriptors;
     }
 
     public MethodDescriptor[] getMethodDescriptors() {
-        if(methodDescriptors == null) {
+        if (methodDescriptors == null) {
             List<MethodDescriptor> result = new ArrayList<MethodDescriptor>();
             List<Method> beanClassMethodsArrayList = getPublicMethods(beanClass);
-            
+
             Iterator<Method> iterator = beanClassMethodsArrayList.iterator();
+
             while (iterator.hasNext()) {
                 Method method = (Method) iterator.next();
                 result.add(new MethodDescriptor(method));
             }
-            
+
             methodDescriptors = new MethodDescriptor[result.size()];
-            for(int i = 0; i < methodDescriptors.length; ++i) {
+            for (int i = 0; i < methodDescriptors.length; ++i) {
                 methodDescriptors[i] = (MethodDescriptor) result.get(i);
             }
-            
+
         }
-        
+
         return methodDescriptors;
     }
 
     public EventSetDescriptor[] getEventSetDescriptors() {
-        if(eventSetDescriptors == null) {
-            Map<String, EventSetDescriptor> result =
-                new HashMap<String, EventSetDescriptor>();
+        if (eventSetDescriptors == null) {
+            Map<String, EventSetDescriptor> result = new HashMap<String, EventSetDescriptor>();
             List<Method> beanClassMethodsArrayList = getPublicMethods(beanClass);
-            
+
             Iterator<Method> iterator = beanClassMethodsArrayList.iterator();
-            while(iterator.hasNext()) {
+
+            while (iterator.hasNext()) {
                 Method method = (Method) iterator.next();
                 String methodName = method.getName();
-                
+
                 String listenerName = null;
-                if(methodName.endsWith("Listener")) {
-                    listenerName = methodName.substring(0,
-                            methodName.lastIndexOf("Listener"));
-                    
-                    if(methodName.startsWith("add")) {
+
+                if (methodName.endsWith("Listener")) {
+                    listenerName = methodName.substring(0, methodName
+                            .lastIndexOf("Listener"));
+
+                    if (methodName.startsWith("add")) {
                         listenerName = listenerName.substring(3);
-                    } else if(methodName.startsWith("remove")) {
+                    } else if (methodName.startsWith("remove")) {
                         listenerName = listenerName.substring(6);
                     } else {
                         continue;
                     }
-                    
-                    if(result.get(listenerName) == null) {
+
+                    if (result.get(listenerName) == null) {
                         Class[] parameterTypes = method.getParameterTypes();
-                        
-                        if(parameterTypes.length == 1) {
+
+                        if (parameterTypes.length == 1) {
                             Class<?> listenerType = parameterTypes[0];
-                            
+
                             // full and short names of classes
                             String listenerTypeName = listenerType.getName();
 
                             // check if the listener name extracted from param name and
                             // listener name extracted from registration method are the same
-                            String listenerNameFromParam =
-                                listenerTypeName.substring(
-                                        listenerTypeName.lastIndexOf(".") + 1);
-                            
+                            String listenerNameFromParam = listenerTypeName
+                                    .substring(listenerTypeName
+                                            .lastIndexOf(".") + 1);
+
                             String listenerNameFromMethod = listenerName
                                     + "Listener";
-                            if(!listenerNameFromParam.equals(
-                                    listenerNameFromMethod)) {
+
+                            if (!listenerNameFromParam
+                                    .equals(listenerNameFromMethod)) {
                                 continue;
                             }
-                            
-                            String eventTypeName = listenerTypeName.substring(0,
-                                    listenerTypeName.lastIndexOf(".") + 1)
+
+                            String eventTypeName = listenerTypeName.substring(
+                                    0, listenerTypeName.lastIndexOf(".") + 1)
                                     + listenerName + "Event";
-                            
+
                             // classes generated from classes names
                             Class<?> eventType = null;
+
                             try {
                                 eventType = Class.forName(eventTypeName, true,
                                         beanClass.getClassLoader());
@@ -173,106 +185,106 @@
                                 System.out.println("Event type with name "
                                         + eventTypeName + " is not found.");
                             } finally {
-                                if(eventType == null) {
+                                if (eventType == null) {
                                     continue;
                                 }
                             }
-                            
+
                             Method[] methods = listenerType.getMethods();
                             Vector<Method> listenerMethodsVec = new Vector<Method>();
-                            for(int i = 0; i < methods.length; ++i) {
-                                Class[] listenerMethodParams =
-                                    methods[i].getParameterTypes();
-                                if(listenerMethodParams.length == 1
+                            for (int i = 0; i < methods.length; ++i) {
+                                Class[] listenerMethodParams = methods[i]
+                                        .getParameterTypes();
+
+                                if (listenerMethodParams.length == 1
                                         && listenerMethodParams[0] == eventType) {
                                     listenerMethodsVec.add(methods[i]);
                                 }
                             }
-                            
-                            Method[] listenerMethods =
-                                    new Method[listenerMethodsVec.size()];
-                            Iterator<Method> iter = listenerMethodsVec.iterator();
+
+                            Method[] listenerMethods = new Method[listenerMethodsVec
+                                    .size()];
+                            Iterator<Method> iter = listenerMethodsVec
+                                    .iterator();
                             int idx2 = 0;
-                            while(iter.hasNext()) {
+                            while (iter.hasNext()) {
                                 listenerMethods[idx2] = (Method) iter.next();
                                 idx2++;
                             }
-                            
+
                             Method addListenerMethod = null;
                             String addListenerMethodName = "add" + listenerName
                                     + "Listener";
                             try {
                                 addListenerMethod = beanClass.getMethod(
-                                    addListenerMethodName,
-                                    new Class[] { listenerType });
+                                        addListenerMethodName,
+                                        new Class[] { listenerType });
                             } catch (NoSuchMethodException nsme) {
                                 // no adder found
                                 continue;
                             }
-                            
+
                             Method removeListenerMethod = null;
                             String removeListenerMethodName = "remove"
                                     + listenerName + "Listener";
                             try {
                                 removeListenerMethod = beanClass.getMethod(
-                                    removeListenerMethodName,
-                                    new Class[] { listenerType });
+                                        removeListenerMethodName,
+                                        new Class[] { listenerType });
                             } catch (NoSuchMethodException nsme) {
                                 // no remover found
                                 continue;
                             }
-                            
+
                             Method getListenerMethod = null;
                             String getListenerMethodName = "get" + listenerName
                                     + "Listeners";
                             try {
                                 getListenerMethod = beanClass.getMethod(
-                                    getListenerMethodName, new Class[] {});
+                                        getListenerMethodName, new Class[] {});
                             } catch (NoSuchMethodException nsme) {
                                 // no action - getter is not a mandatory method in event set descriptor pattern
                             }
 
                             try {
-                                listenerName = Introspector.decapitalize(
-                                        listenerName);
+                                listenerName = Introspector
+                                        .decapitalize(listenerName);
                                 EventSetDescriptor esd = new EventSetDescriptor(
-                                        listenerName,
-                                        listenerType,
-                                        listenerMethods,
-                                        addListenerMethod,
-                                        removeListenerMethod,
-                                        getListenerMethod);
+                                        listenerName, listenerType,
+                                        listenerMethods, addListenerMethod,
+                                        removeListenerMethod, getListenerMethod);
                                 result.put(listenerName, esd);
                             } catch (IntrospectionException ie) {
-                                System.out.println(
-                                        "Cannot generate event set descriptor "
-                                        + "for name" + listenerName + ".");
+                                System.out
+                                        .println("Cannot generate event set descriptor "
+                                                + "for name"
+                                                + listenerName
+                                                + ".");
                             }
-                            
+
                         }
                     }
                 }
             }
-            
-            String[] eventSetDescriptorNames =
-                    new String[result.keySet().size()];
+
+            String[] eventSetDescriptorNames = new String[result.keySet()
+                    .size()];
             Iterator<String> i = result.keySet().iterator();
             int idx = 0;
-            while(i.hasNext()) {
-                eventSetDescriptorNames[idx++] =
-                    ((EventSetDescriptor) result.get(
-                            (String) i.next())).getName();
+
+            while (i.hasNext()) {
+                eventSetDescriptorNames[idx++] = ((EventSetDescriptor) result
+                        .get((String) i.next())).getName();
             }
-            
+
             Arrays.sort(eventSetDescriptorNames);
 
-            eventSetDescriptors =
-                    new EventSetDescriptor[eventSetDescriptorNames.length];
-            for(int j = 0; j < eventSetDescriptors.length; ++j) {
-                eventSetDescriptors[j] = (EventSetDescriptor) result.get(
-                        eventSetDescriptorNames[j]);
+            eventSetDescriptors = new EventSetDescriptor[eventSetDescriptorNames.length];
+            for (int j = 0; j < eventSetDescriptors.length; ++j) {
+                eventSetDescriptors[j] = (EventSetDescriptor) result
+                        .get(eventSetDescriptorNames[j]);
             }
-            
+
         }
         return eventSetDescriptors;
     }
@@ -304,27 +316,30 @@
         int result = MT_OTHER;
         try {
             int modifiers = method.getModifiers();
-            
-            if(Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
+
+            if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
                 Class[] parameterTypes = method.getParameterTypes();
                 Class<?> returnType = method.getReturnType();
 
-                if(name.startsWith("get") && (parameterTypes.length == 0)
+                if (name.startsWith("get") && (parameterTypes.length == 0)
                         && (returnType != void.class) && (name.length() > 3)) {
                     result = MT_GETTER;
-                } else if(name.startsWith("is") && (parameterTypes.length == 0)
-                        && (returnType == boolean.class)
-                        && (name.length() > 2)) {
+                } else if (name.startsWith("is")
+                        && (parameterTypes.length == 0)
+                        && (returnType == boolean.class) && (name.length() > 2)) {
                     result = MT_BOOLEAN_GETTER;
-                } else if(name.startsWith("get") && (parameterTypes.length == 1)
+                } else if (name.startsWith("get")
+                        && (parameterTypes.length == 1)
                         && (returnType != void.class)
                         && (parameterTypes[0] == int.class)
                         && (name.length() > 3)) {
                     result = MT_INDEXED_GETTER;
-                } else if(name.startsWith("set") && (parameterTypes.length == 1)
+                } else if (name.startsWith("set")
+                        && (parameterTypes.length == 1)
                         && (returnType == void.class) && (name.length() > 3)) {
                     result = MT_SETTER;
-                } else if(name.startsWith("set") && (parameterTypes.length == 2)
+                } else if (name.startsWith("set")
+                        && (parameterTypes.length == 2)
                         && (returnType == void.class)
                         && (parameterTypes[0] == int.class)
                         && (name.length() > 3)) {
@@ -334,50 +349,52 @@
         } catch (Exception e) {
             result = MT_OTHER;
         }
-        
+
         return result;
     }
 
     private static String extractPropertyName(String methodName)
             throws Exception {
         String result = null;
-        
-        if ( methodName.startsWith("set") || methodName.startsWith("get") ) {
+
+        if (methodName.startsWith("set") || methodName.startsWith("get")) {
             result = methodName.substring(3);
             result = Introspector.decapitalize(result);
         } else if (methodName.startsWith("is")) {
             result = methodName.substring(2);
             result = Introspector.decapitalize(result);
         }
-        
+
         return result;
     }
 
     private static List<Method> getPublicMethods(Class<?> theClass) {
         List<Method> result = new ArrayList<Method>();
-
         Method[] beanClassMethods = theClass.getDeclaredMethods();
+
         for (int i = 0; i < beanClassMethods.length; ++i) {
-            if(Modifier.isPublic(beanClassMethods[i].getModifiers())) {
+            if (Modifier.isPublic(beanClassMethods[i].getModifiers())) {
                 result.add(beanClassMethods[i]);
             }
         }
-        
+
         return result;
     }
-    
+
     private void addPropertyDescriptorsFromMethodList(
             HashMap<String, PropertyDescriptor> hmPropertyDescriptors,
-            List<Method> methods,
-            boolean checkExisting) throws Exception
-    {
+            List<Method> methods, boolean checkExisting) throws Exception {
         for (Method method : methods) {
             String methodName = method.getName();
             String propertyName = extractPropertyName(methodName);
-            if ((!checkExisting) || (hmPropertyDescriptors.get(propertyName) == null)) {
+
+            if ((!checkExisting)
+                    || (hmPropertyDescriptors.get(propertyName) == null)) {
                 PropertyDescriptor propertyDescriptor = null;
+
                 try {
-                    propertyDescriptor = new PropertyDescriptor(propertyName, beanClass);
+                    propertyDescriptor = new PropertyDescriptor(propertyName,
+                            beanClass);
                     hmPropertyDescriptors.put(propertyName, propertyDescriptor);
                 } catch (IntrospectionException ie) {
                     System.out.println(ie.getClass() + ": " + ie.getMessage());
@@ -385,17 +402,18 @@
             }
         }
     }
-    
+
     private void addIndexedPropertyDescriptorsFromMethodList(
             Map<String, PropertyDescriptor> hmPropertyDescriptors,
-            List<Method> methods,
-            boolean checkExisting) throws Exception
-    {
+            List<Method> methods, boolean checkExisting) throws Exception {
         for (Method method : methods) {
             String methodName = method.getName();
             String propertyName = extractPropertyName(methodName);
-            if ((!checkExisting) || (hmPropertyDescriptors.get(propertyName) == null)) {
+
+            if ((!checkExisting)
+                    || (hmPropertyDescriptors.get(propertyName) == null)) {
                 IndexedPropertyDescriptor indexedPropertyDescriptor = null;
+
                 try {
                     indexedPropertyDescriptor = new IndexedPropertyDescriptor(
                             propertyName, beanClass);
@@ -407,12 +425,17 @@
             }
         }
     }
-    
+
     private Class<?> beanClass = null;
-    private PropertyDescriptor[] propertyDescriptors = null; 
+
+    private PropertyDescriptor[] propertyDescriptors = null;
+
     private MethodDescriptor[] methodDescriptors = null;
+
     private EventSetDescriptor[] eventSetDescriptors = null;
+
     private int defaultPropertyIndex = -1;
+
     private int defaultEventIndex = -1;
-    
+
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java?rev=418239&r1=418238&r2=418239&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java Fri Jun 30 04:20:22 2006
@@ -39,15 +39,16 @@
         PropertyDescriptor[] result = null;
         PropertyDescriptor[] infoResult = null;
         
-        if(info != null) {
-            infoResult = info.getPropertyDescriptors();
-            
+        if (info != null) {
             BeanInfo[] infos = info.getAdditionalBeanInfo();
-            if(infos != null) {
-                for(int i = 0; i < infos.length; ++i) {
+
+            infoResult = info.getPropertyDescriptors();
+
+            if (infos != null) {
+                for (int i = 0; i < infos.length; ++i) {
                     BeanInfo additionalInfo = infos[i];
-                    
-                    if(infoResult == null) {
+
+                    if (infoResult == null) {
                         infoResult = additionalInfo.getPropertyDescriptors();
                     } else {
                         infoResult = concatArraysToOneArray(infoResult,
@@ -56,27 +57,30 @@
                 }
             }
         }
-        
-        if(info == null || infoResult == null) {
+
+        if (info == null || infoResult == null) {
             PropertyDescriptor[] implResult = impl.getPropertyDescriptors();
-            
+
             // merge with parent info
-            if(parentBeanInfoWrapper != null) {
+            if (parentBeanInfoWrapper != null) {
                 PropertyDescriptor[] parentResult =
                         parentBeanInfoWrapper.getPropertyDescriptors();
-                Map<String, FeatureDescriptor> hm = concatArraysUniqueByName(implResult, parentResult);
-                
+                Map<String, FeatureDescriptor> hm =
+                        concatArraysUniqueByName(implResult, parentResult);
+
                 Collection<FeatureDescriptor> values = hm.values();
-                
-                result = new PropertyDescriptor[values.size()];
+                Iterator<FeatureDescriptor> iterator;
                 int idx = 0;
-                Iterator<FeatureDescriptor> iterator = values.iterator();
-                while(iterator.hasNext()) {
+
+                result = new PropertyDescriptor[values.size()];
+                iterator = values.iterator();
+                while (iterator.hasNext()) {
                     result[idx++] = (PropertyDescriptor) iterator.next();
                 }
-                
+
                 Arrays.sort(result, new Comparator<PropertyDescriptor>() {
-                    public int compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
+                    public int compare(PropertyDescriptor pd1,
+                            PropertyDescriptor pd2) {
                         return pd1.getName().compareTo(pd2.getName());
                     }
                     public boolean equals(Object o) {
@@ -97,15 +101,16 @@
         MethodDescriptor[] result = null;
         MethodDescriptor[] infoResult = null;
         
-        if(info != null) {
-            infoResult = info.getMethodDescriptors();
-            
+        if (info != null) {
             BeanInfo[] infos = info.getAdditionalBeanInfo();
-            if(infos != null) {
-                for(int i = 0; i < infos.length; ++i) {
+
+            infoResult = info.getMethodDescriptors();
+
+            if (infos != null) {
+                for (int i = 0; i < infos.length; ++i) {
                     BeanInfo additionalInfo = infos[i];
-                    
-                    if(infoResult == null) {
+
+                    if (infoResult == null) {
                         infoResult = additionalInfo.getMethodDescriptors();
                     } else {
                         infoResult = concatArraysToOneArray(infoResult,
@@ -114,14 +119,15 @@
                 }
             }
         }
-        
-        if(info == null || infoResult == null) {
+
+        if (info == null || infoResult == null) {
             MethodDescriptor[] implResult = impl.getMethodDescriptors();
-            
+
             // merge with parent info
-            if(parentBeanInfoWrapper != null) {
+            if (parentBeanInfoWrapper != null) {
                 MethodDescriptor[] parentResult =
                         parentBeanInfoWrapper.getMethodDescriptors();
+
                 result = concatArraysToOneArray(implResult, parentResult);
             } else {
                 result = implResult;
@@ -130,7 +136,7 @@
             result = infoResult;
         }
 
-        if(result != null) {
+        if (result != null) {
             Arrays.sort(result, new Comparator<MethodDescriptor>() {
                 public int compare(MethodDescriptor md1, MethodDescriptor md2) {
                     return md1.getName().compareTo(md2.getName());
@@ -147,16 +153,17 @@
     public EventSetDescriptor[] getEventSetDescriptors() {
         EventSetDescriptor[] result = null;
         EventSetDescriptor[] infoResult = null;
-        
-        if(info != null) {
-            infoResult = info.getEventSetDescriptors();
-            
+
+        if (info != null) {
             BeanInfo[] infos = info.getAdditionalBeanInfo();
-            if(infos != null) {
-                for(int i = 0; i < infos.length; ++i) {
+
+            infoResult = info.getEventSetDescriptors();
+
+            if (infos != null) {
+                for (int i = 0; i < infos.length; ++i) {
                     BeanInfo additionalInfo = infos[i];
-                    
-                    if(infoResult == null) {
+
+                    if (infoResult == null) {
                         infoResult = additionalInfo.getEventSetDescriptors();
                     } else {
                         infoResult = concatArraysToOneArray(infoResult,
@@ -165,27 +172,30 @@
                 }
             }
         }
-        
-        if(info == null || infoResult == null) {
+
+        if (info == null || infoResult == null) {
             EventSetDescriptor[] implResult = impl.getEventSetDescriptors();
-            
+
             // merge with parent info
-            if(parentBeanInfoWrapper != null) {
+            if (parentBeanInfoWrapper != null) {
                 EventSetDescriptor[] parentResult =
                         parentBeanInfoWrapper.getEventSetDescriptors();
-                Map<String, FeatureDescriptor> hm = concatArraysUniqueByName(implResult, parentResult);
+                Map<String, FeatureDescriptor> hm = concatArraysUniqueByName(
+                        implResult, parentResult);
                 
                 Collection<FeatureDescriptor> values = hm.values();
+                Iterator<FeatureDescriptor> iterator;
+                int idx = 0;
                 
                 result = new EventSetDescriptor[values.size()];
-                int idx = 0;
-                Iterator<FeatureDescriptor> iterator = values.iterator();
-                while(iterator.hasNext()) {
+                iterator = values.iterator();
+                while (iterator.hasNext()) {
                     result[idx++] = (EventSetDescriptor) iterator.next();
                 }
                 
                 Arrays.sort(result, new Comparator<EventSetDescriptor>() {
-                    public int compare(EventSetDescriptor esd1, EventSetDescriptor esd2) {
+                    public int compare(EventSetDescriptor esd1,
+                                       EventSetDescriptor esd2) {
                         return esd1.getName().compareTo(esd2.getName());
                     }
                     public boolean equals(Object o) {
@@ -198,69 +208,69 @@
         } else {
             result = infoResult;
         }
-        
+
         return result;
     }
 
     public BeanInfo[] getAdditionalBeanInfo() {
         BeanInfo[] result = null;
-        
-        if(info != null) {
+
+        if (info != null) {
             result = info.getAdditionalBeanInfo();
         }
-        
+
         return result;
     }
 
     public BeanDescriptor getBeanDescriptor() {
         BeanDescriptor result = null;
-        
-        if(info != null) {
+
+        if (info != null) {
             result = info.getBeanDescriptor();
         }
-        
-        if(info == null || result == null) {
+
+        if (info == null || result == null) {
             result = impl.getBeanDescriptor();
         }
-        
+
         return result;
     }
 
     public Image getIcon(int iconKind) {
         Image result = null;
-        
-        if(info != null) {
+
+        if (info != null) {
             result = info.getIcon(iconKind);
         }
-        
+
         return result;
     }
 
     public int getDefaultPropertyIndex() {
         int result = -1;
-        
-        if(info != null) {
+
+        if (info != null) {
             result = info.getDefaultPropertyIndex();
         }
-        
-        if(info == null || result == -1) {
+
+        if (info == null || result == -1) {
             result = impl.getDefaultPropertyIndex();
         }
-        
+
         return result;
     }
 
     public int getDefaultEventIndex() {
         int result = -1;
-        
-        if(info != null) {
+
+        if (info != null) {
             result = info.getDefaultEventIndex();
         }
         
-        if(info == null || result == -1) {
+        if (info == null || result == -1) {
             result = impl.getDefaultEventIndex();
         }
-        
+
         return result;
     }
     
@@ -268,41 +278,46 @@
         this.parentBeanInfoWrapper = parentBeanInfoWrapper;
     }
     
-    private static Map<String, FeatureDescriptor> concatArraysUniqueByName(FeatureDescriptor[] childs,
-            FeatureDescriptor[] parents) {
-        Map<String, FeatureDescriptor> result = new HashMap<String, FeatureDescriptor>();
-        
-        if(childs != null) {
-            for(int i = 0; i < childs.length; ++i) {
+    private static Map<String, FeatureDescriptor>
+            concatArraysUniqueByName(FeatureDescriptor[] childs,
+                                     FeatureDescriptor[] parents)
+    {
+        Map<String, FeatureDescriptor> result =
+                new HashMap<String, FeatureDescriptor>();
+
+        if (childs != null) {
+            for (int i = 0; i < childs.length; ++i) {
                 result.put(childs[i].getName(), childs[i]);
             }
         }
-        
-        if(parents != null) {
-            for(int j = 0; j < parents.length; ++j) {
-                if(result.get(parents[j].getName()) == null) {
+
+        if (parents != null) {
+            for (int j = 0; j < parents.length; ++j) {
+                if (result.get(parents[j].getName()) == null) {
                     result.put(parents[j].getName(), parents[j]);
                 }
             }
         }
-        
+
         return result;
     }
     
     private static PropertyDescriptor[] concatArraysToOneArray(
             PropertyDescriptor[] childs, PropertyDescriptor[] parents) {
-        if(childs != null || parents != null) {
-            Map<String, FeatureDescriptor> hm = concatArraysUniqueByName(childs, parents);
+        if (childs != null || parents != null) {
+            Map<String, FeatureDescriptor> hm = concatArraysUniqueByName(
+                    childs, parents);
             PropertyDescriptor[] result = new PropertyDescriptor[hm.size()];
-            
+
             Iterator<String> iterator = hm.keySet().iterator();
             int idx = 0;
-            
-            while(iterator.hasNext()) {
+
+            while (iterator.hasNext()) {
                 String name = (String) iterator.next();
+
                 result[idx++] = (PropertyDescriptor) hm.get(name);
             }
-            
+
             return result;
         } else {
             return null;
@@ -313,51 +328,54 @@
             MethodDescriptor[] childs, MethodDescriptor[] parents) {
         MethodDescriptor[] result = null;
         
-        if(childs != null || parents != null) {
+        if (childs != null || parents != null) {
             int resultLength = 0;
-            
-            if(childs != null) {
+
+            if (childs != null) {
                 resultLength = childs.length; 
             }
-            
-            if(parents != null) {
+
+            if (parents != null) {
                 resultLength += parents.length;
             }
-            
+
             result = new MethodDescriptor[resultLength];
 
-            if(childs != null) {
-                for(int i = 0; i < childs.length; ++i) {
+            if (childs != null) {
+                for (int i = 0; i < childs.length; ++i) {
                     result[i] = childs[i];
                 }
             }
             
-            if(parents != null) {
-                int shift = (childs == null) ? 0 : childs.length; 
-                for(int i = 0; i < parents.length; ++i) {
+            if (parents != null) {
+                int shift = (childs == null) ? 0 : childs.length;
+
+                for (int i = 0; i < parents.length; ++i) {
                     result[shift + i] = parents[i];
                 }
             }
             
         }
-        
+
         return result;
     }
     
     private static EventSetDescriptor[] concatArraysToOneArray(
             EventSetDescriptor[] childs, EventSetDescriptor[] parents) {
-        if(childs != null || parents != null) {
-            Map<String, FeatureDescriptor> hm = concatArraysUniqueByName(childs, parents);
+        if (childs != null || parents != null) {
+            Map<String, FeatureDescriptor> hm =
+                    concatArraysUniqueByName(childs, parents);
             EventSetDescriptor[] result = new EventSetDescriptor[hm.size()];
-            
+
             Iterator<String> iterator = hm.keySet().iterator();
             int idx = 0;
-            
-            while(iterator.hasNext()) {
+
+            while (iterator.hasNext()) {
                 String name = (String) iterator.next();
+
                 result[idx++] = (EventSetDescriptor) hm.get(name);
             }
-            
+
             return result;
         } else {
             return null;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java?rev=418239&r1=418238&r2=418239&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java Fri Jun 30 04:20:22 2006
@@ -34,47 +34,41 @@
  */
 
 public class Beans {
-	
-	private static boolean designTime = false;
-	private static boolean guiAvailable = false;
+
+    private static boolean designTime = false;
+
+    private static boolean guiAvailable = false;
 
     /**
      */
-    public Beans() {
-    }
+    public Beans() {}
 
     /**
      * @com.intel.drl.spec_ref
      */
-    public static Object instantiate(ClassLoader cls,
-                                     String beanName,
-                                     BeanContext beanContext,
-                                     AppletInitializer initializer)
-    	throws IOException, ClassNotFoundException
-    {
+    public static Object instantiate(ClassLoader cls, String beanName,
+            BeanContext beanContext, AppletInitializer initializer)
+            throws IOException, ClassNotFoundException {
         Object result = instantiate(cls, beanName, beanContext);
-        
-        if(result instanceof Applet) {
+
+        if (result instanceof Applet) {
             initializer.initialize((Applet) result, beanContext);
         }
-        
+
         return result;
     }
 
     /**
      * @com.intel.drl.spec_ref
      */
-    public static Object instantiate(ClassLoader cls,
-                                     String beanName,
-                                     BeanContext beanContext)
-        throws IOException, ClassNotFoundException
-    {
+    public static Object instantiate(ClassLoader cls, String beanName,
+            BeanContext beanContext) throws IOException, ClassNotFoundException {
         Object result = instantiate(cls, beanName);
-        
-        if(beanContext != null) {
+
+        if (beanContext != null) {
             beanContext.add(result);
         }
-        
+
         return result;
     }
 
@@ -82,22 +76,20 @@
      * @com.intel.drl.spec_ref
      */
     public static Object instantiate(ClassLoader cls, String beanName)
-        throws IOException, ClassNotFoundException
-    {
+            throws IOException, ClassNotFoundException {
         Object result = null;
 
         String beanResourceName = getBeanResourceName(beanName);
-        
-        InputStream is = (cls == null) ?
-            ClassLoader.getSystemResourceAsStream(beanResourceName) :
-            cls.getResourceAsStream(beanResourceName);
-            
-        if(is != null) {
+
+        InputStream is = (cls == null) ? ClassLoader
+                .getSystemResourceAsStream(beanResourceName) : cls
+                .getResourceAsStream(beanResourceName);
+
+        if (is != null) {
             try {
-                ObjectInputStream ois = (cls == null) ?
-                    new ObjectInputStream(is) :
-                    new CustomizedObjectInputStream(is, cls);
-                
+                ObjectInputStream ois = (cls == null) ? new ObjectInputStream(
+                        is) : new CustomizedObjectInputStream(is, cls);
+
                 try {
                     result = ois.readObject();
                 } catch (ClassNotFoundException cnfe) {
@@ -107,42 +99,43 @@
                 // skip exception
             }
         }
-        
+
         if (result == null) {
-			try {
-				Class<?> c = Class.forName(beanName, true,
-						cls == null ? ClassLoader.getSystemClassLoader() : cls);
-
-				try {
-					result = c.newInstance();
-
-					if (result instanceof Applet) {
-						Applet applet = (Applet) result;
-						applet.init();
-					}
-				} catch (IllegalAccessException iae) {
-					throw new ClassNotFoundException(iae.getClass() + ": "
-							+ iae.getMessage());
-				}
-			} catch (InstantiationException ie) {
-				throw new ClassNotFoundException(ie.getClass() + ": "
-						+ ie.getMessage());
-			}
-		}
-        
+            try {
+                Class<?> c = Class.forName(beanName, true,
+                        cls == null ? ClassLoader.getSystemClassLoader() : cls);
+
+                try {
+                    result = c.newInstance();
+
+                    if (result instanceof Applet) {
+                        Applet applet = (Applet) result;
+
+                        applet.init();
+                    }
+                } catch (IllegalAccessException iae) {
+                    throw new ClassNotFoundException(iae.getClass() + ": "
+                            + iae.getMessage());
+                }
+            } catch (InstantiationException ie) {
+                throw new ClassNotFoundException(ie.getClass() + ": "
+                        + ie.getMessage());
+            }
+        }
+
         return result;
     }
 
     /**
-	 * @com.intel.drl.spec_ref
-	 */
+     * @com.intel.drl.spec_ref
+     */
     public static Object getInstanceOf(Object bean, Class<?> targetType) {
-        return bean;            
+        return bean;
     }
 
     /**
-	 * @com.intel.drl.spec_ref
-	 */
+     * @com.intel.drl.spec_ref
+     */
     public static boolean isInstanceOf(Object bean, Class<?> targetType) {
         if (targetType == null) {
             return false;
@@ -155,22 +148,20 @@
      * @com.intel.drl.spec_ref
      */
     public static void setGuiAvailable(boolean isGuiAvailable)
-        throws SecurityException
-    {
+            throws SecurityException {
         checkPropertiesAccess();
-        guiAvailable = isGuiAvailable; 
+        guiAvailable = isGuiAvailable;
     }
 
     /**
      * @com.intel.drl.spec_ref
      */
     public static void setDesignTime(boolean isDesignTime)
-        throws SecurityException
-    {
+            throws SecurityException {
         checkPropertiesAccess();
-        designTime = isDesignTime; 
+        designTime = isDesignTime;
     }
-    
+
     /**
      * @com.intel.drl.spec_ref
      */
@@ -184,79 +175,77 @@
     public static boolean isDesignTime() {
         return designTime;
     }
-    
+
     private static void checkPropertiesAccess() throws SecurityException {
         SecurityManager sm = System.getSecurityManager();
-        
-        if (sm != null)    {
+
+        if (sm != null) {
             sm.checkPropertiesAccess();
         }
     }
-    
+
     private static String getBeanResourceName(String beanName) {
         return beanName.replace('.', '/') + ".ser";
     }
-    
+
 }
 
-/*
- Customized object input stream that allows
- to read objects by specified class loader
-*/
+/**
+ * Customized object input stream that allows
+ * to read objects by specified class loader
+ */
 class CustomizedObjectInputStream extends ObjectInputStream {
-    
+
     private ClassLoader cls;
-    
+
     public CustomizedObjectInputStream(InputStream in, ClassLoader cls)
             throws IOException {
         super(in);
         this.cls = cls;
     }
-    
-    protected Class<?> resolveClass(ObjectStreamClass desc)
-        throws IOException, ClassNotFoundException
-    {
+
+    protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException,
+            ClassNotFoundException {
         String className = desc.getName();
-        
-        if(className.startsWith("[")) {
+
+        if (className.startsWith("[")) {
             int idx = className.lastIndexOf("[");
-            
             String prefix = className.substring(0, idx + 1);
-            
             int[] dimensions = new int[prefix.length()];
-            for(int i = 0; i < dimensions.length; ++i) {
+            String postfix;
+            Class<?> componentType = null;
+
+            for (int i = 0; i < dimensions.length; ++i) {
                 dimensions[i] = 0;
             }
-            
-            String postfix = className.substring(idx + 1);
-            
-            Class<?> componentType = null;
-            if(postfix.equals("Z")) {
+
+            postfix = className.substring(idx + 1);
+            if (postfix.equals("Z")) {
                 componentType = boolean.class;
-            } else if(postfix.equals("B")) {
+            } else if (postfix.equals("B")) {
                 componentType = byte.class;
-            } else if(postfix.equals("C")) {
+            } else if (postfix.equals("C")) {
                 componentType = char.class;
-            } else if(postfix.equals("D")) {
+            } else if (postfix.equals("D")) {
                 componentType = double.class;
-            } else if(postfix.equals("F")) {
+            } else if (postfix.equals("F")) {
                 componentType = float.class;
-            } else if(postfix.equals("I")) {
+            } else if (postfix.equals("I")) {
                 componentType = int.class;
-            } else if(postfix.equals("L")) {
+            } else if (postfix.equals("L")) {
                 componentType = long.class;
-            } else if(postfix.equals("S")) {
+            } else if (postfix.equals("S")) {
                 componentType = short.class;
-            } else if(postfix.equals("V")) {
+            } else if (postfix.equals("V")) {
                 componentType = null;
-            } else if(postfix.startsWith("L")){
-                componentType = cls.loadClass(postfix.substring(1,
-                        postfix.length() - 1));
+            } else if (postfix.startsWith("L")) {
+                componentType = cls.loadClass(postfix.substring(1, postfix
+                        .length() - 1));
             } else {
                 throw new IllegalArgumentException("Illegal class name: "
                         + className);
             }
-            
+
             return Array.newInstance(componentType, dimensions).getClass();
         } else {
             return Class.forName(className, true, cls);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java?rev=418239&r1=418238&r2=418239&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java Fri Jun 30 04:20:22 2006
@@ -28,7 +28,7 @@
  */
 
 public class DefaultPersistenceDelegate extends PersistenceDelegate {
-    
+
     private String[] constructorPropertyNames;
 
     /**
@@ -51,44 +51,42 @@
     protected void initialize(Class<?> type, Object oldInstance,
             Object newInstance, Encoder out) {
         try {
-            PropertyDescriptor[] pds =
-                    Introspector.getBeanInfo(type).getPropertyDescriptors();
-            
-            for(int i = 0; i < pds.length; ++i) {
+            PropertyDescriptor[] pds = Introspector.getBeanInfo(type)
+                    .getPropertyDescriptors();
+
+            for (int i = 0; i < pds.length; ++i) {
                 PropertyDescriptor pd = pds[i];
-                
-                if(!isTransient(pd)) {
+
+                if (!isTransient(pd)) {
                     Method getter = pd.getReadMethod();
-                    
-                    if(getter != null) {
-                           Method setter = pd.getWriteMethod();
-                           
-                           if(setter != null) {
-                               Object oldValue = getter.invoke(oldInstance,
-                                       null);
-                               Object newValue = getter.invoke(newInstance,
-                                       null);
-                               
-                               if(oldValue != null && !oldValue.equals(newValue)
-                                       || oldValue == null && newValue != null)
-                               {
-                                   String setterName = setter.getName();
-                                   Statement s = new Statement(oldInstance,
-                                           setterName,
-                                           new Object[] { oldValue } );
-                                   out.writeStatement(s);
-                               }
-                           } else {
-                               // commented since the process should be continued even if no setter is found
-                               // throw new Exception("no setter for " + pd.getName() + " property.");
-                               continue;
-                           }
+
+                    if (getter != null) {
+                        Method setter = pd.getWriteMethod();
+
+                        if (setter != null) {
+                            Object oldValue = getter.invoke(oldInstance, null);
+                            Object newValue = getter.invoke(newInstance, null);
+
+                            if (oldValue != null && !oldValue.equals(newValue)
+                                    || oldValue == null && newValue != null) {
+                                String setterName = setter.getName();
+                                Statement s = new Statement(oldInstance,
+                                        setterName, new Object[] { oldValue });
+
+                                out.writeStatement(s);
+                            }
+                        } else {
+                            // commented since the process should be
+                            // continued even if no setter is found
+                            // throw new Exception("no setter for " + pd.getName() + " property.");
+                            continue;
+                        }
                     }
                 }
             }
         } catch (Exception e) {
-            System.out.println("in DefaultPersistenceDelegate initialize() " +
-                    e.getClass() + " :" + e.getMessage());
+            System.out.println("in DefaultPersistenceDelegate initialize() "
+                    + e.getClass() + " :" + e.getMessage());
         }
     }
 
@@ -97,51 +95,53 @@
      */
     protected Expression instantiate(Object oldInstance, Encoder out) {
         Object[] args = null;
-        
-        if(constructorPropertyNames == null
+
+        if (constructorPropertyNames == null
                 || constructorPropertyNames.length == 0) {
             args = new Object[] {};
         } else {
             args = new Object[constructorPropertyNames.length];
-            
+
             try {
                 PropertyDescriptor[] pds = Introspector.getBeanInfo(
                         oldInstance.getClass()).getPropertyDescriptors();
-                
-                for(int i = 0; i < constructorPropertyNames.length; ++i) {
-                    
+
+                for (int i = 0; i < constructorPropertyNames.length; ++i) {
+
                     boolean found = false;
-                    
-                    for(int j = 0; j < pds.length; ++j) {
-                        
-                        if(constructorPropertyNames[i].equals(pds[j].getName())) {
+
+                    for (int j = 0; j < pds.length; ++j) {
+
+                        if (constructorPropertyNames[i]
+                                .equals(pds[j].getName())) {
                             Method getter = pds[j].getReadMethod();
-                            
-                            if(getter != null) {
+
+                            if (getter != null) {
                                 args[i] = getter.invoke(oldInstance, null);
                                 found = true;
                                 break;
                             } else {
-                                throw new Exception("no getter for " +
-                                    pds[j].getName() + " property");
+                                throw new Exception("no getter for "
+                                        + pds[j].getName() + " property");
                             }
-                            
+
                         }
                     } // for j
-                    
-                    if(found == false) {
-                        throw new Exception("no property for name " +
-                            constructorPropertyNames[i] + " is found");
+
+                    if (found == false) {
+                        throw new Exception("no property for name "
+                                + constructorPropertyNames[i] + " is found");
                     }
-                    
+
                 } // for i
             } catch (Exception e) {
-                System.out.println("in DefaultPersistenceDelegate instantiate() "
-                        + e.getClass() + " :" + e.getMessage());
+                System.out
+                        .println("in DefaultPersistenceDelegate instantiate() "
+                                + e.getClass() + " :" + e.getMessage());
             }
-            
+
         }
-        
+
         return new Expression(oldInstance, oldInstance.getClass(), "new", args);
     }
 
@@ -149,26 +149,30 @@
      * @com.intel.drl.spec_ref
      */
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
-        if(oldInstance != null) {
+        if (oldInstance != null) {
             try {
                 Method equalsMethod = oldInstance.getClass().getMethod(
-                    "equals", new Class[] { Object.class });
-                if(equalsMethod != null) {
+                        "equals", new Class[] { Object.class });
+
+                if (equalsMethod != null) {
                     Object result = equalsMethod.invoke(oldInstance,
-                            new Object[] { newInstance } );
-                       return ((Boolean) result).booleanValue();
+                            new Object[] { newInstance });
+
+                    return ((Boolean) result).booleanValue();
                 }
-            } catch(Exception e) {
+            } catch (Exception e) {
                 System.out.println("in DefaultPersistenceDelegate.mutatesTo() "
                         + e.getClass() + " :" + e.getMessage());
+
                 return false;
             }
         }
         return super.mutatesTo(oldInstance, newInstance);
     }
-    
+
     private static boolean isTransient(PropertyDescriptor pd) {
         Boolean isTransient = (Boolean) pd.getValue("transient");
+
         return (isTransient != null) && isTransient.equals(Boolean.TRUE);
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java?rev=418239&r1=418238&r2=418239&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java Fri Jun 30 04:20:22 2006
@@ -41,17 +41,20 @@
 public class XMLDecoder {
 
     private InputStream is = null;
+
     private Object owner = null;
+
     private ExceptionListener exceptionListener = null;
-    
+
     private Vector objects = new Vector();
+
     private Iterator iterator = null;
-    
+
     /**
      * @com.intel.drl.spec_ref
      */
-    public XMLDecoder(
-            InputStream is, Object owner, ExceptionListener exceptionListener) {
+    public XMLDecoder(InputStream is, Object owner,
+            ExceptionListener exceptionListener) {
         this.is = is;
         this.owner = owner;
         this.exceptionListener = exceptionListener;
@@ -68,19 +71,23 @@
     /**
      * @com.intel.drl.spec_ref
      */
-    public XMLDecoder(InputStream is) {    this.is = is; }
+    public XMLDecoder(InputStream is) {
+        this.is = is;
+    }
 
     /**
      * @com.intel.drl.spec_ref
      */
-    public void setOwner(Object owner) { this.owner = owner; }
+    public void setOwner(Object owner) {
+        this.owner = owner;
+    }
 
     /**
      * @com.intel.drl.spec_ref
      */
     public Object readObject() {
         try {
-            if(iterator == null) {
+            if (iterator == null) {
                 initialize();
             }
             return iterator.next();
@@ -92,7 +99,9 @@
     /**
      * @com.intel.drl.spec_ref
      */
-    public Object getOwner() { return owner; }
+    public Object getOwner() {
+        return owner;
+    }
 
     /**
      * @com.intel.drl.spec_ref
@@ -118,22 +127,23 @@
             handleException(ioe);
         }
     }
-    
+
     private void handleException(Exception e) {
-        if(exceptionListener != null) {
+        if (exceptionListener != null) {
             exceptionListener.exceptionThrown(e);
         }
     }
-    
+
     private void initialize() {
         try {
-            String saxParserClassName = System.getProperty(
-                    "org.xml.sax.driver");
-            if(saxParserClassName == null) {
+            String saxParserClassName = System
+                    .getProperty("org.xml.sax.driver");
+
+            if (saxParserClassName == null) {
                 saxParserClassName = "org.apache.xerces.parsers.SAXParser";
             }
-            XMLReader xmlReader = XMLReaderFactory.createXMLReader(
-                    saxParserClassName);
+            XMLReader xmlReader = XMLReaderFactory
+                    .createXMLReader(saxParserClassName);
             xmlReader.setContentHandler(new Handler(this, objects));
             xmlReader.parse(new InputSource(is));
         } catch (SAXException saxe) {



Mime
View raw message