harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r495932 - 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 Sat, 13 Jan 2007 17:35:39 GMT
Author: apetrenko
Date: Sat Jan 13 09:35:38 2007
New Revision: 495932

URL: http://svn.apache.org/viewvc?view=rev&rev=495932
Log:
Patch for HARMONY-2896 "[classlib][swing] Compatibility: javax.swing.plaf.basic.BasicComboBoxUI.
getAccessibleChildrenCount(null) does not throw unspecified NPE"

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=495932&r1=495931&r2=495932
==============================================================================
--- 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
Sat Jan 13 09:35:38 2007
@@ -481,6 +481,9 @@
 
 
     public int getAccessibleChildrenCount(final JComponent c) {
+        if (comboBox == null) {
+            throw new NullPointerException("comboBox is null");
+        }
         return 0;
     }
 

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=495932&r1=495931&r2=495932
==============================================================================
--- 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
Sat Jan 13 09:35:38 2007
@@ -29,6 +29,7 @@
 import javax.swing.DefaultListCellRenderer;
 import javax.swing.JButton;
 import javax.swing.JComboBox;
+import javax.swing.JComponent;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JTextField;
@@ -257,6 +258,23 @@
         assertEquals(new Rectangle(0, 0, 0, 0), r1);
         Rectangle r2 = ui.rectangleForCurrentValue();
         assertFalse(r1 == r2);
+    }
+
+    // Regression test for HARMONY-2896
+    public void testGetAccessibleChildrenCount() throws Exception {
+        ui.comboBox = null;
+        try {
+            ui.getAccessibleChildrenCount(new JComponent() {});
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
+        try {
+            ui.getAccessibleChildrenCount(null);
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
     }
 
     public void testGetInsets() throws Exception {



Mime
View raw message