Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P3
-
Resolution: Duplicate
-
Affects Version/s: 1.1.6
-
Fix Version/s: None
-
Component/s: client-libs
-
Labels:
-
Subcomponent:
-
CPU:sparc
-
OS:solaris_2.5.1
Description
Name: aaC67449 Date: 02/10/98
Method Polygon.getBounds() returns incorrect value whenever another
point is added to the polygon.
The problem is originated from void Polygon.updateBounds().
-------------------Example-----------------------------------
import java.awt.*;
public class Test {
public static void main(String argv[]) {
int x[]={2,2,2};
int y[]={2,3,4};
Polygon p=new Polygon(x,y,3);
p.getBounds();
p.addPoint(1,1);
if(!p.getBounds().equals(new Rectangle(1,1,1,3)))
System.out.println("Failed. Incorrect bounds returned: "
+p.getBounds());
}
}
-------------------Output------------------------------------
Failed. Incorrect bounds returned: java.awt.Rectangle[x=1,y=1,width=0,height=2]
Please note that this bug is already fixed in JDK 1.2. It exists
only in versions 1.1.6 or earlier.
======================================================================
Attachments
Issue Links
- duplicates
-
JDK-4072640 java.awt.Polygon.updateBounds(int x,int y) can incorrectly update the bounds.
-
- Closed
-