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 17:30:56 UTC

svn commit: r495917 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/JEditorPane.java test/api/java/common/javax/swing/JEditorPaneTest.java

Author: hindessm
Date: Sat Jan 13 08:30:55 2007
New Revision: 495917

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

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JEditorPane.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JEditorPane.java?view=diff&rev=495917&r1=495916&r2=495917
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JEditorPane.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JEditorPane.java Sat Jan 13 08:30:55 2007
@@ -259,6 +259,11 @@
 
     public static void registerEditorKitForContentType(final String type,
             final String editorKitName, final ClassLoader loader) {
+
+        if (type == null || editorKitName == null) {
+            throw new NullPointerException();
+        }
+
         int index = contentTypes.indexOf(type);
         if (index >= 0) {
             contentTypes.remove(index);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JEditorPaneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JEditorPaneTest.java?view=diff&rev=495917&r1=495916&r2=495917
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JEditorPaneTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JEditorPaneTest.java Sat Jan 13 08:30:55 2007
@@ -382,6 +382,13 @@
                 "javax.swing.JEditorPaneTest$SimpleEditorKit");
         assertEquals("javax.swing.JEditorPaneTest$SimpleEditorKit", JEditorPane
                 .getEditorKitClassNameForContentType("text/test1"));
+
+        try {         
+            JEditorPane.registerEditorKitForContentType(null, null);
+            fail("NPE should be thrown");               
+        } catch (NullPointerException npe) {               
+            // PASSED            
+        }
     }
 
     public void testRegisterEditorKitForContentTypeStringStringClassLoader() {