harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r556551 - 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 08:37:44 GMT
Author: tonywu
Date: Mon Jul 16 01:37:43 2007
New Revision: 556551

URL: http://svn.apache.org/viewvc?view=rev&rev=556551
Log:
Fix bug: EventSetDescriptor can not handle the default package

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=556551&r1=556550&r2=556551
==============================================================================
--- 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
Mon Jul 16 01:37:43 2007
@@ -399,8 +399,11 @@
 
     private Method findMethodByPrefix(Class<?> sourceClass,
             String prefix, String postfix) {
-        String shortName = BeanInfoImpl.extractShortClassName(
-                listenerType.getName());
+        String shortName = listenerType.getName();
+        if(listenerType.getPackage()!= null){
+            shortName = shortName.substring(
+                listenerType.getPackage().getName().length() + 1);
+        }
         String methodName = prefix + shortName + postfix;
         Class listenerType = this.awtEventListener == null? this.listenerType:this.awtEventListener;
         try {

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=556551&r1=556550&r2=556551
==============================================================================
--- 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
Mon Jul 16 01:37:43 2007
@@ -36,6 +36,7 @@
 import org.apache.harmony.beans.tests.support.mock.MockPropertyChangeListener;
 import org.apache.harmony.beans.tests.support.mock.MockPropertyChangeValidListener;
 
+
 /**
  * Unit test for EventSetDescriptor
  */
@@ -88,6 +89,9 @@
         assertEquals(listenerType, esd.getListenerType());
         assertTrue(esd.isInDefaultEventSet());
         assertFalse(esd.isUnicast());
+        
+        esd = new EventSetDescriptor(AnObject.class, "something",
+                AnObjectListener.class, "aMethod");
     }
 
     public void testEventSetDescriptorClassStringClassString2()
@@ -1334,6 +1338,17 @@
         // No removeActionListener() method
     }
     
+    private interface AnObjectListener {
+        public void aMethod( SomethingEvent s );
+    }
+
+    private static class AnObject {
+            public void addEventSetDescriptorTest$AnObjectListener( AnObjectListener l )
{}
+            public void removeEventSetDescriptorTest$AnObjectListener( AnObjectListener l
) {}
+    }
+    
+    private static class SomethingEvent {
     
+    }
 
 }



Mime
View raw message