harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject 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
Date Sat, 13 Jan 2007 15:23:17 GMT
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            
+        }
     }
 
     /*



Mime
View raw message