harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r599489 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java test/api/java.injected/javax/swing/JComboBoxTest.java
Date Thu, 29 Nov 2007 15:33:54 GMT
Author: apetrenko
Date: Thu Nov 29 07:33:51 2007
New Revision: 599489

URL: http://svn.apache.org/viewvc?rev=599489&view=rev
Log:
Patch the fix and unit test update for HARMONY-5223 
"[classlib][swing][EIOffice] JComboBox.setEditor throws NPE if 
editor.getEditorComponent returns null"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JComboBoxTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java?rev=599489&r1=599488&r2=599489&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java
Thu Nov 29 07:33:51 2007
@@ -408,8 +408,10 @@
 
     public void addEditor() {
         editor = comboBox.getEditor().getEditorComponent();
-        configureEditor();
-        comboBox.add(editor);
+        if (editor != null) {
+            configureEditor();
+            comboBox.add(editor);
+        }
     }
 
     public void removeEditor() {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JComboBoxTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JComboBoxTest.java?rev=599489&r1=599488&r2=599489&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JComboBoxTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/JComboBoxTest.java
Thu Nov 29 07:33:51 2007
@@ -20,6 +20,7 @@
  */
 package javax.swing;
 
+import java.awt.Component;
 import java.awt.EventQueue;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -793,6 +794,23 @@
     public void testInstallAncestorListener() throws Exception {
         assertEquals(1, comboBox.getAncestorListeners().length);
     }
+    
+    public void testHarmony5223() {
+        ComboBoxEditor editor = new NullComboBoxEditor();
+        comboBox.setEditor(editor);
+        assertEquals(editor, comboBox.getEditor());
+    }
+    
+    public class NullComboBoxEditor extends BasicComboBoxEditor {
+        public NullComboBoxEditor() {
+            super();
+        }
+
+        public Component getEditorComponent() {
+            return null;
+        }
+    }
+
 
     private class ActionController implements ActionListener {
         private ActionEvent event;



Mime
View raw message