harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495922 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/JEditorPane.java test/api/java/common/javax/swing/JEditorPaneTest.java
Date Sat, 13 Jan 2007 16:48:01 GMT
Author: hindessm
Date: Sat Jan 13 08:48:00 2007
New Revision: 495922

URL: http://svn.apache.org/viewvc?view=rev&rev=495922
Log:
Applying patch from "[#HARMONY-2577] [classlib][swing]
javax.swing.JEditorPane.setEditorKitForContentType() 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=495922&r1=495921&r2=495922
==============================================================================
--- 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:48:00 2007
@@ -628,6 +628,10 @@
     }
 
     public void setEditorKitForContentType(final String type, final EditorKit kit) {
+        if (type == null || kit == null) {
+            throw new NullPointerException();
+        }
+  
         int index = localContentTypes.indexOf(contentType);
         if (index >= 0) {
             localContentTypes.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=495922&r1=495921&r2=495922
==============================================================================
--- 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:48:00 2007
@@ -820,4 +820,30 @@
                 .getEditorKitClassNameForContentType("text/rtf"));
         assertNull(JEditorPane.getEditorKitClassNameForContentType("..."));
     }
+
+    public void testSetEditorKitForContentType() throws Exception {
+        try {          
+            JEditorPane ep = new JEditorPane();
+            ep.setEditorKitForContentType("abc", null);
+            fail("NPE expected"); 
+        } catch (NullPointerException npe) {              
+            // PASSED            
+        }   
+        
+        try {          
+            JEditorPane ep = new JEditorPane();
+            ep.setEditorKitForContentType(null, new DefaultEditorKit());
+            fail("NPE expected");             
+        } catch (NullPointerException npe) {              
+            // PASSED            
+        }  
+        
+        try {          
+            JEditorPane ep = new JEditorPane();             
+            ep.setEditorKitForContentType(null, null);
+            fail("NPE expected"); 
+        } catch (NullPointerException npe) {              
+            // PASSED            
+        }  
+    }
 }



Mime
View raw message