-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0, 1.2.1
-
beta
-
sparc
-
solaris_2.5
Name: dsC58869 Date: 12/04/98
The method Rectangle getBounds() works wrong for empty polygons.
In this case it is expected for the method to return null
or an empty rectangle, but the returned rectangle is not empty.
==== Here is the test demonstrating the bug ====
import java.awt.*;
public class Test {
public static void main (String args[]) {
Polygon p = new Polygon();
Rectangle r = p.getBounds();
System.out.println(r);
if(r == null || r.isEmpty())
System.out.println("OKAY");
else
System.out.println("failed");
}
}
==== Here is the output of the test ====
%java -fullversion
java full version "JDK-1.2-V"
%java Test
java.awt.Rectangle[x=2147483647,y=2147483647,width=1,height=1]
failed
======================================================================
Justification:
The method should work properly
======================================================================
- duplicates
-
JDK-4221516 java.awt.Polygon.getBounds() behaves erroneously when Polygon has 0 points
- Closed