harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lian...@apache.org
Subject svn commit: r488103 - in /harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/ main/java/org/apache/harmony/beans/internal/nls/ test/java/org/apache/harmony/beans/tests/java/beans/
Date Mon, 18 Dec 2006 03:05:23 GMT
Author: liangyx
Date: Sun Dec 17 19:05:23 2006
New Revision: 488103

URL: http://svn.apache.org/viewvc?view=rev&rev=488103
Log:
Apply patch for HARMONY-2495 ([classlib][beans] java.beans.EventHandler.invoke( Object,Method
method,Object[] arguments) does not throw unspecified NPE if method==null)

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/internal/nls/messages.properties
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java?view=diff&rev=488103&r1=488102&r2=488103
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
Sun Dec 17 19:05:23 2006
@@ -60,7 +60,6 @@
 
             // if a valid object
             if (handler instanceof EventHandler) {
-
                 // if the method from the Object class is called
                 if (method.getDeclaringClass().equals(Object.class)) {
                     if (method.getName().equals("hashCode") && //$NON-NLS-1$
@@ -98,6 +97,12 @@
                                 "beans.4D"));
                     }
                 }
+            }
+        } else {
+            //HARMONY-2495
+            if (null == method) {
+                throw new NullPointerException(Messages.getString(
+                        "beans.55")); //$NON-NLS-1$
             }
         }
 

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/internal/nls/messages.properties?view=diff&rev=488103&r1=488102&r2=488103
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/internal/nls/messages.properties
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/internal/nls/messages.properties
Sun Dec 17 19:05:23 2006
@@ -100,3 +100,4 @@
 beans.52=listenerMethodName(s) is null
 beans.53=eventSetName is null
 beans.54=listenerType is null
+beans.55=Method is null

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java?view=diff&rev=488103&r1=488102&r2=488103
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
Sun Dec 17 19:05:23 2006
@@ -732,6 +732,14 @@
                 new Class[] { Object.class });
         assertEquals(Boolean.FALSE, handler.invoke(proxy, equalsMethod,
                 new String[] { "mock" }));
+        // Test null method with non-proxy Object.
+        handler = new EventHandler(new Object(), "a", "a", "a");
+        try {
+            handler.invoke(new Object(), null, new Object[] {});
+            fail("should throw NPE.");
+        } catch (NullPointerException e) {
+            // expected;
+        }
     }
 
     public void testIncompatibleMethod() {



Mime
View raw message