You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2007/07/24 15:21:35 UTC

svn commit: r559044 - /harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java

Author: apetrenko
Date: Tue Jul 24 06:21:34 2007
New Revision: 559044

URL: http://svn.apache.org/viewvc?view=rev&rev=559044
Log:
Patch for HARMONY-4524 "[classlib][swing] BasicSplitPaneUI throws NPE if vertical split pane was not fully initialized"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.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=559044&r1=559043&r2=559044
==============================================================================
--- 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 Tue Jul 24 06:21:34 2007
@@ -76,8 +76,10 @@
                 int rightCompY = leftCompY;
                 int rightCompWidth = container.getWidth() - leftCompWidth - divWidth - insets.left - insets.right;
                 
-                if (rightCompWidth < components[RIGHT_COMPONENT_INDEX].getMinimumSize().width
-                    && leftCompWidth > components[LEFT_COMPONENT_INDEX].getMinimumSize().width) {
+                if ((components[RIGHT_COMPONENT_INDEX] != null)
+                        && (components[LEFT_COMPONENT_INDEX] != null)
+                        && rightCompWidth < components[RIGHT_COMPONENT_INDEX].getMinimumSize().width
+                        && leftCompWidth > components[LEFT_COMPONENT_INDEX].getMinimumSize().width) {
                     
                     rightCompWidth = components[RIGHT_COMPONENT_INDEX].getMinimumSize().width;
                     leftCompWidth = container.getWidth() - rightCompWidth - divWidth - insets.left - insets.right;
@@ -122,9 +124,13 @@
                 int rightCompY = divY + divHeight;
                 int rightCompHeight = container.getHeight() - leftCompHeight - divHeight - insets.top - insets.bottom;
                 
-                if (rightCompHeight < components[RIGHT_COMPONENT_INDEX].getMinimumSize().height
-                    && leftCompHeight > components[LEFT_COMPONENT_INDEX].getMinimumSize().height) {
-                        
+                if ((components[RIGHT_COMPONENT_INDEX] != null)
+                        && (components[LEFT_COMPONENT_INDEX] != null)
+                        && rightCompHeight < components[RIGHT_COMPONENT_INDEX]
+                                .getMinimumSize().height
+                        && leftCompHeight > components[LEFT_COMPONENT_INDEX]
+                                .getMinimumSize().height) {
+                    
                     rightCompHeight = components[RIGHT_COMPONENT_INDEX].getMinimumSize().height;
                     leftCompHeight = container.getHeight() - rightCompHeight - divHeight - insets.top - insets.bottom;