harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r556524 - in /harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/EventSetDescriptor.java test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java
Date Mon, 16 Jul 2007 06:51:58 GMT
Author: tonywu
Date: Sun Jul 15 23:51:56 2007
New Revision: 556524

URL: http://svn.apache.org/viewvc?view=rev&rev=556524
Log:
Fix bug: When add/remove action is not supported on the target, an IntrospectionException
should be thrown out in constructor

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

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=556524&r1=556523&r2=556524
==============================================================================
--- 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
Sun Jul 15 23:51:56 2007
@@ -59,7 +59,7 @@
         removeListenerMethod = findMethodByPrefix(
                 sourceClass, "remove", ""); //$NON-NLS-1$ //$NON-NLS-2$
 
-        if (addListenerMethod == null && removeListenerMethod == null) {
+        if (addListenerMethod == null || removeListenerMethod == null) {
             throw new IntrospectionException(
                     Messages.getString("beans.38")); //$NON-NLS-1$
         }

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java?view=diff&rev=556524&r1=556523&r2=556524
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java
Sun Jul 15 23:51:56 2007
@@ -17,6 +17,7 @@
 
 package org.apache.harmony.beans.tests.java.beans;
 
+import java.awt.event.ActionListener;
 import java.beans.EventSetDescriptor;
 import java.beans.IntrospectionException;
 import java.beans.MethodDescriptor;
@@ -1254,6 +1255,17 @@
         }
 
     }
+    
+    //Regression Test
+    public void testConstructor_withLackRemoveActionBean() throws Exception {
+        try {
+            new EventSetDescriptor(LackRemoveActionBean.class, "action",
+                    ActionListener.class, "actionPerformed");
+            fail("should throw IntrospectionException");
+        } catch (IntrospectionException e) {
+            // expected
+        }
+    }
 
     protected String getUnQualifiedClassName(Class<?> classType) {
         String qName = classType.getName();
@@ -1299,5 +1311,13 @@
 
         }
     }
+    
+    public class LackRemoveActionBean {
+        public void addActionListener(ActionListener al) {
+        }
+        // No removeActionListener() method
+    }
+    
+    
 
 }



Mime
View raw message