harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r519965 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicProgressBarUI.java test/api/java/common/javax/swing/plaf/basic/BasicProgressBarUITest.java
Date Mon, 19 Mar 2007 14:53:17 GMT
Author: apetrenko
Date: Mon Mar 19 07:53:15 2007
New Revision: 519965

URL: http://svn.apache.org/viewvc?view=rev&rev=519965
Log:
Patch for HARMONY-2698 "[classlib][swing] javax.swing.plaf.basic.BasicProgressBarUI.getPreferredInnerHorizontal()
returns null while RI throws NPE"

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicProgressBarUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicProgressBarUI.java?view=diff&rev=519965&r1=519964&r2=519965
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicProgressBarUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicProgressBarUI.java
Mon Mar 19 07:53:15 2007
@@ -222,10 +222,16 @@
     }
 
     protected Dimension getPreferredInnerHorizontal() {
+        if (progressBar == null) {
+            throw new NullPointerException();
+        }
         return horizontalSize;
     }
 
     protected Dimension getPreferredInnerVertical() {
+        if (progressBar == null) {
+            throw new NullPointerException();
+        }
         return verticalSize;
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicProgressBarUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicProgressBarUITest.java?view=diff&rev=519965&r1=519964&r2=519965
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicProgressBarUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicProgressBarUITest.java
Mon Mar 19 07:53:15 2007
@@ -182,4 +182,32 @@
             super.stopAnimationTimer();
         }
     }
+    
+    public void testHarmony2698Regression() {
+        class testBasicProgressBarUI extends BasicProgressBarUI { 
+            public Dimension getPreferredInnerVertical() { 
+                return super.getPreferredInnerVertical(); 
+            } 
+      
+        public Dimension getPreferredInnerHorizontal() { 
+            return super.getPreferredInnerHorizontal(); 
+            } 
+        }
+
+        try { 
+            testBasicProgressBarUI pb = new testBasicProgressBarUI();
+            pb.getPreferredInnerHorizontal(); 
+            fail("NPE expected"); 
+        } catch (NullPointerException e) { 
+            //expected
+        } 
+
+        try { 
+            testBasicProgressBarUI pb = new testBasicProgressBarUI(); 
+            pb.getPreferredInnerVertical(); 
+            fail("NPE expected"); 
+        } catch (NullPointerException e) { 
+            //expected
+        } 
+    }
 }



Mime
View raw message