You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2007/01/13 16:23:17 UTC

svn commit: r495908 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/JComponent.java test/api/java/common/javax/swing/JComponentTest.java

Author: hindessm
Date: Sat Jan 13 07:23:16 2007
New Revision: 495908

URL: http://svn.apache.org/viewvc?view=rev&rev=495908
Log:
Applying patch from "[#HARMONY-2548] [classlib][swing] javax.swing.JComponent.putClientProperty(null, Object) does not throw unspecified NPE"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java?view=diff&rev=495908&r1=495907&r2=495908
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComponent.java Sat Jan 13 07:23:16 2007
@@ -481,6 +481,10 @@
     }
 
     public final void putClientProperty(Object key, Object value) {
+        if (key == null) {
+            throw new NullPointerException();
+        }
+
         Object oldValue = (value != null) ? clientProperties.put(key, value) : clientProperties
                 .remove(key);
         if (oldValue != value) {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentTest.java?view=diff&rev=495908&r1=495907&r2=495908
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentTest.java Sat Jan 13 07:23:16 2007
@@ -1071,6 +1071,14 @@
         changeListener.checkLastPropertyFired(panel, key1, value2, null);
         assertNull(panel.getClientProperty(key1));
         changeListener.reset();
+
+        try {         
+            JComponent jc = new JComponent() {}; 
+            jc.putClientProperty(null, new Object());
+            fail("NPE should be thrown");               
+        } catch (NullPointerException npe) {               
+            // PASSED            
+        }
     }
 
     /*