harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r496287 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java test/api/java/common/javax/swing/plaf/basic/BasicComboBoxUITest.java
Date Mon, 15 Jan 2007 11:53:51 GMT
Author: hindessm
Date: Mon Jan 15 03:53:50 2007
New Revision: 496287

URL: http://svn.apache.org/viewvc?view=rev&rev=496287
Log:
Applying patches from "[#HARMONY-2898] [classlib][swing]
javax.swing.plaf.basic.BasicComboBoxUI.paintCurrentValueBackground throws
unspecified NPE on RI and doesn't on Harmony".

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/common/javax/swing/plaf/basic/BasicComboBoxUITest.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?view=diff&rev=496287&r1=496286&r2=496287
==============================================================================
--- 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
Mon Jan 15 03:53:50 2007
@@ -426,6 +426,9 @@
 
     public void paintCurrentValueBackground(final Graphics g, final Rectangle bounds, final
boolean hasFocus) {
         Color oldColor = g.getColor();
+        if (comboBox == null) {
+            throw new NullPointerException("comboBox is null");
+        }
         if (hasFocus) {
             g.setColor(UIManager.getColor("ComboBox.selectionBackground"));
         } else {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicComboBoxUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicComboBoxUITest.java?view=diff&rev=496287&r1=496286&r2=496287
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicComboBoxUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicComboBoxUITest.java
Mon Jan 15 03:53:50 2007
@@ -417,6 +417,17 @@
         ui.paintCurrentValueBackground(createTestGraphics(), new Rectangle(0, 0, 10, 10),
true);
     }
 
+    // Regression test for HARMONY-2898
+    public void testPaintCurrentValueBackground_Null() throws Exception {
+        ui.comboBox = null;
+        try {
+            ui.paintCurrentValueBackground(createTestGraphics(), new Rectangle(0, 0, 10,
10), true);
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
+    }
+
     public void testPaintCurrentValue() throws Exception {
         ui.comboBox = comboBox;
         ui.popup = new BasicComboPopup(comboBox);



Mime
View raw message