harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r495672 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java
Date Fri, 12 Jan 2007 18:09:56 GMT
Author: ayza
Date: Fri Jan 12 10:09:56 2007
New Revision: 495672

URL: http://svn.apache.org/viewvc?view=rev&rev=495672
Log:
Applying patch from HARMONY-2767 ([classlib][swing] javax.swing.plaf.basic.BasicSplitPaneUI.getMaximumSize(JScrollBar
sb) throws NPE while RI does not)

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java?view=diff&rev=495672&r1=495671&r2=495672
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java
Fri Jan 12 10:09:56 2007
@@ -750,15 +750,21 @@
     }
 
     public Dimension getPreferredSize(final JComponent jc) {
-        return layoutManager.preferredLayoutSize(jc);
+        return ((layoutManager != null)
+                ? layoutManager.preferredLayoutSize(jc)
+                : new Dimension(0, 0));
     }
 
     public Dimension getMinimumSize(final JComponent jc) {
-        return layoutManager.minimumLayoutSize(jc);
+        return ((layoutManager != null)
+                ? layoutManager.minimumLayoutSize(jc)
+                : new Dimension(0, 0));
     }
 
     public Dimension getMaximumSize(final JComponent jc) {
-        return layoutManager.maximumLayoutSize(jc);
+        return ((layoutManager != null)
+                ? layoutManager.maximumLayoutSize(jc)
+                : new Dimension(0, 0));
     }
 
     public Insets getInsets(final JComponent jc) {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java?view=diff&rev=495672&r1=495671&r2=495672
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSplitPaneUITest.java
Fri Jan 12 10:09:56 2007
@@ -27,6 +27,7 @@
 import java.awt.Rectangle;
 import javax.swing.BorderFactory;
 import javax.swing.JButton;
+import javax.swing.JComponent;
 import javax.swing.JSplitPane;
 import javax.swing.JViewport;
 import javax.swing.SwingTestCase;
@@ -326,5 +327,16 @@
         assertEquals(
                 new Rectangle(insets.left, location, cW - insets.left - insets.right, size),
b
                         .getBounds());
+    }
+
+    public void testGetSizes() { // Regression test for HARMONY-2767
+        ui = new BasicSplitPaneUI();
+        JComponent component = new JComponent() {};
+        assertEquals(new Dimension(0, 0), ui.getPreferredSize(component));
+        assertEquals(new Dimension(0, 0), ui.getPreferredSize(null));
+        assertEquals(new Dimension(0, 0), ui.getMinimumSize(component));
+        assertEquals(new Dimension(0, 0), ui.getMinimumSize(null));
+        assertEquals(new Dimension(0, 0), ui.getMaximumSize(component));
+        assertEquals(new Dimension(0, 0), ui.getMaximumSize(null));
     }
 }



Mime
View raw message