harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r495282 - 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 Thu, 11 Jan 2007 16:22:46 GMT
Author: odeakin
Date: Thu Jan 11 08:22:45 2007
New Revision: 495282

URL: http://svn.apache.org/viewvc?view=rev&rev=495282
Log:
Apply patch HARMONY-2886 ([classlib][swing] Compatibility: javax.swing.plaf.basic.BasicComboBoxUI.ComboBoxLayoutManager.minimumLayoutSize(null)
returns valid result while RI throws 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=495282&r1=495281&r2=495282
==============================================================================
--- 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 Jan 11 08:22:45 2007
@@ -79,10 +79,16 @@
         }
 
         public Dimension preferredLayoutSize(final Container parent) {
+            if (parent == null) {
+                throw new NullPointerException("parent is null");
+            }
             return new Dimension(0, 0);
         }
 
         public Dimension minimumLayoutSize(final Container parent) {
+            if (parent == null) {
+                throw new NullPointerException("parent is null");
+            }
             return new Dimension(0, 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=495282&r1=495281&r2=495282
==============================================================================
--- 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
Thu Jan 11 08:22:45 2007
@@ -473,6 +473,25 @@
         BasicComboBoxUI cb = new BasicComboBoxUI();
         cb.removeEditor();
     }
+
+    public void testComboBoxLayoutManager() throws Exception {
+        BasicComboBoxUI ui = new BasicComboBoxUI();
+        BasicComboBoxUI.ComboBoxLayoutManager b = ui.new ComboBoxLayoutManager();
+
+        // Regression test for HARMONY-2886
+        try {
+            b.minimumLayoutSize(null);
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
+        try {
+            b.preferredLayoutSize(null);
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
+    }
     
     @SuppressWarnings("deprecation")
     private void createVisibleCombo() {



Mime
View raw message