-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.2.1
-
sparc
-
solaris_2.5
Name: saC57035 Date: 03/19/99
java.awt.Polygon.Polygon(int[] xpoints, int[] ypoints, int npoints) throws
OutOfMemoryError exeption being given huge npoints value.
The valid response in this case should be ArrayIndexOutOfBoundsException,
as npoints evidently exceeds the capacity of array parameters.
Here is the test demonstrating the bug:
-----------------Test.java------------------------
import java.awt.*;
public class Test {
public static void main(String[] args) {
int[] x={-10,10,10,-10};
int[] y={-10,-10,10,10};
try {
Polygon p = new Polygon(x, y, Integer.MAX_VALUE);
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println("PASSED. " + e + " is thrown");
} catch (Throwable e) {
System.out.println("FAILED. " + e + " is thrown");
e.printStackTrace();
}
}
}
---------Output from the test---------------------
FAILED. java.lang.OutOfMemoryError is thrown
java.lang.OutOfMemoryError
at Test.main(Test.java, Compiled Code)
--------------------------------------------------
======================================================================