harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r442924 - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/geom/ test/api/java/common/java/awt/geom/
Date Wed, 13 Sep 2006 10:09:15 GMT
Author: mloenko
Date: Wed Sep 13 03:09:12 2006
New Revision: 442924

URL: http://svn.apache.org/viewvc?view=rev&rev=442924
Log:
applied patch for HARMONY-1403
[classlib][awt] Arc2D doesn't throw IAE for invalid type value

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/geom/Arc2D.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DDoubleTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DFloatTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/geom/Arc2D.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/geom/Arc2D.java?view=diff&rev=442924&r1=442923&r2=442924
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/geom/Arc2D.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/geom/Arc2D.java
Wed Sep 13 03:09:12 2006
@@ -486,6 +486,9 @@
     }
 
     public void setArcType(int type) {
+        if (type != OPEN && type != CHORD && type != PIE) {
+            throw new IllegalArgumentException("Invalid type of Arc: " + type);
+        }
         this.type = type;
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DDoubleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DDoubleTest.java?view=diff&rev=442924&r1=442923&r2=442924
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DDoubleTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DDoubleTest.java
Wed Sep 13 03:09:12 2006
@@ -20,6 +20,7 @@
 package java.awt.geom;
 
 import java.awt.Rectangle;
+import java.awt.geom.Arc2D;
 
 public class Arc2DDoubleTest extends GeomTestCase {
 
@@ -45,10 +46,28 @@
 
     public void testCreate2() {
         assertEquals(new Arc2D.Double(0, 0, 0, 0, 0, 0, Arc2D.CHORD), new Arc2D.Double(Arc2D.CHORD));
+        
+        // Regression for HARMONY-1403
+        try {
+            // Invalid type
+            new Arc2D.Double(7);
+            fail("Expected IAE");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
     }
 
     public void testCreate3() {
         assertEquals(new Arc2D.Double(1, 2, 3, 4, 5, 6, Arc2D.CHORD), new Arc2D.Double(new
Rectangle(1, 2, 3, 4), 5, 6, Arc2D.PIE));
+        
+        // Regression for HARMONY-1403
+        try {
+            // Invalid type
+            new Arc2D.Double(new Rectangle(1, 2, 3, 4), 5, 6, 4);
+            fail("Expected IAE");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
     }
 
     public void testGetX() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DFloatTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DFloatTest.java?view=diff&rev=442924&r1=442923&r2=442924
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DFloatTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DFloatTest.java
Wed Sep 13 03:09:12 2006
@@ -20,6 +20,7 @@
 package java.awt.geom;
 
 import java.awt.Rectangle;
+import java.awt.geom.Arc2D;
 
 public class Arc2DFloatTest extends GeomTestCase {
 
@@ -45,10 +46,28 @@
 
     public void testCreate2() {
         assertEquals(new Arc2D.Float(0, 0, 0, 0, 0, 0, Arc2D.CHORD), new Arc2D.Float(Arc2D.CHORD));
+        
+        // Regression for HARMONY-1403
+        try {
+            // Invalid type
+            new Arc2D.Float(-13);
+            fail("Expected IAE");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
     }
 
     public void testCreate3() {
         assertEquals(new Arc2D.Float(1, 2, 3, 4, 5, 6, Arc2D.CHORD), new Arc2D.Float(new
Rectangle(1, 2, 3, 4), 5, 6, Arc2D.PIE));
+        
+        // Regression for HARMONY-1403
+        try {
+            // Invalid type
+            new Arc2D.Float(new Rectangle(1, 2, 3, 4), 5, 6, 8);
+            fail("Expected IAE");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
     }
 
     public void testGetX() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DTest.java?view=diff&rev=442924&r1=442923&r2=442924
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DTest.java
Wed Sep 13 03:09:12 2006
@@ -22,6 +22,7 @@
 import java.awt.Dimension;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.geom.Arc2D;
 import java.awt.geom.ShapeTestCase;
 
 public class Arc2DTest extends ShapeTestCase {
@@ -188,6 +189,15 @@
     public void testSetArcType() {
         a.setArcType(Arc2D.CHORD);
         assertEquals("Arc type", Arc2D.CHORD, a.getArcType());
+        
+        // Regression for HARMONY-1403
+        try {
+            // Invalid type
+            a.setArcType(17);
+            fail("Expected IAE");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
     }
 
     public void testGetStartPoint() {



Mime
View raw message