harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r504096 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicOptionPaneUI.java test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUI_ButtonAreaLayoutTest.java
Date Tue, 06 Feb 2007 12:05:51 GMT
Author: apetrenko
Date: Tue Feb  6 04:05:50 2007
New Revision: 504096

URL: http://svn.apache.org/viewvc?view=rev&rev=504096
Log:
Patch for HARMONY-2900 "[classlib][swing] j.s.plaf.basic.BasicOptionPaneUI.ButtonAreaLayout.preferredLayoutSize(null)
throws NPE"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicOptionPaneUI.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUI_ButtonAreaLayoutTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicOptionPaneUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicOptionPaneUI.java?view=diff&rev=504096&r1=504095&r2=504096
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicOptionPaneUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicOptionPaneUI.java
Tue Feb  6 04:05:50 2007
@@ -156,6 +156,10 @@
         }
 
         public Dimension preferredLayoutSize(final Container parent) {
+            if (parent == null) {
+                return new Dimension();
+            }
+
             int totalWidth = 0;
             int totalHeight = getMaxChildHeight(parent);
             int numChildren = parent.getComponentCount();

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUI_ButtonAreaLayoutTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUI_ButtonAreaLayoutTest.java?view=diff&rev=504096&r1=504095&r2=504096
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUI_ButtonAreaLayoutTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUI_ButtonAreaLayoutTest.java
Tue Feb  6 04:05:50 2007
@@ -320,6 +320,13 @@
                 .preferredLayoutSize(container));
     }
 
+    // Regression for HARMONY-2900
+    public void testPreferedLayoutSize() {
+        layout = new BasicOptionPaneUI.ButtonAreaLayout(false, 20);
+        assertEquals(new Dimension(), layout.preferredLayoutSize(null));
+        // no exception expected
+    }
+
     public void testRemoveLayoutComponent() {
         Container container = new JPanel();
         JComponent component1 = new JPanel();



Mime
View raw message