harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495972 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/JScrollBar.java test/api/java/common/javax/swing/JScrollBarTest.java
Date Sat, 13 Jan 2007 21:32:37 GMT
Author: hindessm
Date: Sat Jan 13 13:32:36 2007
New Revision: 495972

URL: http://svn.apache.org/viewvc?view=rev&rev=495972
Log:
Applying patch from "[#HARMONY-2623] [classlib][swing] JScrollBar() throw
unspecified NPE instead of IAE".  I fixed the syntax error in test patch.

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JScrollBar.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JScrollBarTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JScrollBar.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JScrollBar.java?view=diff&rev=495972&r1=495971&r2=495972
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JScrollBar.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JScrollBar.java
Sat Jan 13 13:32:36 2007
@@ -119,6 +119,11 @@
 
     public JScrollBar(final int orientation, final int value, final int extent, final int
min, final int max) {
         model = new DefaultBoundedRangeModel(value, extent, min, max);
+
+        if (orientation != HORIZONTAL && orientation != VERTICAL) {
+            throw new IllegalArgumentException("Orientation is not HORIZONTAL or VERTICAL");
+        } 
+
         this.orientation = orientation;
         blockIncrement = extent;
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JScrollBarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JScrollBarTest.java?view=diff&rev=495972&r1=495971&r2=495972
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JScrollBarTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JScrollBarTest.java
Sat Jan 13 13:32:36 2007
@@ -52,6 +52,17 @@
         testList = null;
     }
 
+    public void testConstructor() throws Exception {
+        try {         
+            new JScrollBar(2000, 512, 128, 16, 10001); 
+            fail("IllegalArgumentException should be thrown");
+        } catch (NullPointerException npe) {    
+            fail("NPE should not be thrown");            
+        } catch (IllegalArgumentException iae) {
+            // PASSED
+        }
+    }
+
     public void testGetAccessibleContext() throws Exception {
         JScrollBar.AccessibleJScrollBar accJScrollBar = (JScrollBar.AccessibleJScrollBar)
bar
                 .getAccessibleContext();



Mime
View raw message