commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r617884 - /commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathBasicBeanInfo.java
Date Sat, 02 Feb 2008 20:29:34 GMT
Author: mbenson
Date: Sat Feb  2 12:29:31 2008
New Revision: 617884

URL: http://svn.apache.org/viewvc?rev=617884&view=rev
Log:
avoid error due to calling getBeanInfo(Object.class, Object.class)

Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathBasicBeanInfo.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathBasicBeanInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathBasicBeanInfo.java?rev=617884&r1=617883&r2=617884&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathBasicBeanInfo.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/JXPathBasicBeanInfo.java
Sat Feb  2 12:29:31 2008
@@ -73,27 +73,32 @@
 
     public synchronized PropertyDescriptor[] getPropertyDescriptors() {
         if (propertyDescriptors == null) {
-            try {
-                BeanInfo bi = null;
-                if (clazz.isInterface()) {
-                    bi = Introspector.getBeanInfo(clazz);
+            if (clazz == Object.class) {
+                propertyDescriptors = new PropertyDescriptor[0];
+            }
+            else {
+                try {
+                    BeanInfo bi = null;
+                    if (clazz.isInterface()) {
+                        bi = Introspector.getBeanInfo(clazz);
+                    }
+                    else {
+                        bi = Introspector.getBeanInfo(clazz, Object.class);
+                    }
+                    PropertyDescriptor[] pds = bi.getPropertyDescriptors();
+                    PropertyDescriptor[] descriptors = new PropertyDescriptor[pds.length];
+                    System.arraycopy(pds, 0, descriptors, 0, pds.length);
+                    Arrays.sort(descriptors, new Comparator() {
+                        public int compare(Object left, Object right) {
+                            return ((PropertyDescriptor) left).getName().compareTo(
+                                ((PropertyDescriptor) right).getName());
+                        }
+                    });
+                    propertyDescriptors = descriptors;
                 }
-                else {
-                    bi = Introspector.getBeanInfo(clazz, Object.class);
+                catch (IntrospectionException ex) {
+                    ex.printStackTrace();
                 }
-                PropertyDescriptor[] pds = bi.getPropertyDescriptors();
-                PropertyDescriptor[] descriptors = new PropertyDescriptor[pds.length];
-                System.arraycopy(pds, 0, descriptors, 0, pds.length);
-                Arrays.sort(descriptors, new Comparator() {
-                    public int compare(Object left, Object right) {
-                        return ((PropertyDescriptor) left).getName().compareTo(
-                            ((PropertyDescriptor) right).getName());
-                    }
-                });
-                propertyDescriptors = descriptors;
-            }
-            catch (IntrospectionException ex) {
-                ex.printStackTrace();
             }
         }
         return propertyDescriptors;



Mime
View raw message