harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r559680 - in /harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/PropertyDescriptor.java test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java
Date Thu, 26 Jul 2007 03:21:30 GMT
Author: tonywu
Date: Wed Jul 25 20:21:29 2007
New Revision: 559680

URL: http://svn.apache.org/viewvc?view=rev&rev=559680
Log:
Fix bug: did not check the arguments number for default get method

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java

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=559680&r1=559679&r2=559680
==============================================================================
--- 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 25 20:21:29 2007
@@ -246,8 +246,10 @@
                 Method[] methods = beanClass.getMethods();
                 for (Method method : methods) {
                     if (method.getName().equals(setterName)) {
-                        writeMethod = method;
-                        break;
+                        if (method.getParameterTypes().length == 1) {
+                            writeMethod = method;
+                            break;
+                        }
                     }
                 }
             }

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java?view=diff&rev=559680&r1=559679&r2=559680
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java
Wed Jul 25 20:21:29 2007
@@ -771,6 +771,33 @@
         assertEquals(String[].class, ipd.getPropertyType());
         assertEquals("set" + anotherProp, ipd.getIndexedWriteMethod().getName());
     }
+    
+    public void testIndexedPropertyDescriptorStringClassStringStringStringString_WrongArgumentNumber()
+            throws IntrospectionException {
+        IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("a", DummyClass.class,
null, "setAI",
+                "getAI", "setAI");
+        assertNotNull(ipd);
+    }
+
+    private class DummyClass {
+        private int[] a;
+
+        public void setAI(int v, int i) {
+            a[i] = v;
+        }
+
+        public void setAI(int[] a) {
+            this.a = a;
+        }
+
+        public int[] getA() {
+            return a;
+        }
+
+        public int getAI(int i) {
+            return a[i];
+        }
+    }
 
     /*
      * Class under test for void IndexedPropertyDescriptor(String, Method,



Mime
View raw message