harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject 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
Date Mon, 12 Mar 2007 09:50:37 GMT
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 {



Mime
View raw message