harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r399662 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/PropertyChangeSupport.java test/java/org/apache/harmony/tests/java/beans/PropertyChangeSupportTest.java
Date Thu, 04 May 2006 11:14:00 GMT
Author: mloenko
Date: Thu May  4 04:13:56 2006
New Revision: 399662

URL: http://svn.apache.org/viewcvs?rev=399662&view=rev
Log:
fixes for HARMONY-441
[classlib] java.beans.PropertyChangeSupport.addPropertyChangeListener(String, PropertyChangeListener)
should not throw NPE if propertyName == null

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/PropertyChangeSupportTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java?rev=399662&r1=399661&r2=399662&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java
Thu May  4 04:13:56 2006
@@ -86,19 +86,17 @@
     /**
      * @com.intel.drl.spec_ref
      */
-    public synchronized void addPropertyChangeListener(
-            String propertyName, PropertyChangeListener listener) {
-        if(propertyName == null) {
-            throw new NullPointerException("propertyName is null");
-        } else if(listener != null) {
-            ArrayList listeners =
-                (ArrayList) selectedPropertiesChangeListeners.get(propertyName);
-            
+    public synchronized void addPropertyChangeListener(String propertyName,
+            PropertyChangeListener listener) {
+        if (listener != null && propertyName != null) {
+            ArrayList listeners = (ArrayList) selectedPropertiesChangeListeners
+                    .get(propertyName);
+
             if (listeners == null) {
                 listeners = new ArrayList();
                 selectedPropertiesChangeListeners.put(propertyName, listeners);
             }
-            
+
             listeners.add(listener);
         }
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/PropertyChangeSupportTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/PropertyChangeSupportTest.java?rev=399662&r1=399661&r2=399662&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/PropertyChangeSupportTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/PropertyChangeSupportTest.java
Thu May  4 04:13:56 2006
@@ -65,13 +65,23 @@
      *        java.lang.Object)
      */
     public void testConstructor_Null() {
+        // Regression for HARMONY-227
         try {
-            // Regression for HARMONY-227
             new PropertyChangeSupport(null);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException ex) {
             // expected
         }
+    }
+
+    /**
+     * @tests java.beans.PropertyChangeSupport#addPropertyChangeSupport
+     * 
+     */
+    public void test_addPropertyChangeListenerNullNull() throws Exception {
+        // Regression for HARMONY-441
+        new PropertyChangeSupport("bean1")
+                .addPropertyChangeListener(null, null);
     }
 
     /**



Mime
View raw message