You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2007/03/12 10:50:37 UTC

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

Author: apetrenko
Date: Mon Mar 12 02:50:36 2007
New Revision: 517154

URL: http://svn.apache.org/viewvc?view=rev&rev=517154
Log:
Patch for HARMONY-2571 "[classlib][swing] javax.swing.JEditorPane.getEditorKitClassNameForContentType(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=517154&r1=517153&r2=517154
==============================================================================
--- 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 Mon Mar 12 02:50:36 2007
@@ -257,6 +257,10 @@
     }
 
     public static String getEditorKitClassNameForContentType(final String type) {
+        if (type == null) {
+            throw new NullPointerException();
+        }
+
         int index = contentTypes.indexOf(type);
         return (index >= 0) ? editorKitNames.get(index) : null;
     }

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=517154&r1=517153&r2=517154
==============================================================================
--- 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 Mon Mar 12 02:50:36 2007
@@ -819,6 +819,13 @@
         assertEquals("javax.swing.text.rtf.RTFEditorKit", JEditorPane
                 .getEditorKitClassNameForContentType("text/rtf"));
         assertNull(JEditorPane.getEditorKitClassNameForContentType("..."));
+        
+        // Regression test for HARMONY-2571
+        try { 
+            JEditorPane.getEditorKitClassNameForContentType(null); 
+            fail("NPE expected"); 
+        } catch (NullPointerException e) { 
+        } 
     }
 
     public void testSetEditorKitForContentType() throws Exception {