Name: atR10191 Date: 11/26/2001
specification for method
public abstract void setClip(Shape clip)
of class java.awt.Graphics does not state that the method can throw an
exception. But in case of PBP-b13 and PP-b39 the method throws an
IllegalArgumentException being passed a Polygon object
============ Test37.java ==============================================
import java.awt.*;
public class Test37 {
public static void main(String[] args) {
Frame frm = new Frame();
frm.show();
Graphics g = frm.getGraphics();
int[] xpoints = {0,-10,0,10};
int[] ypoints = {0,10,20,10};
int x, y, width, height;
g.setClip(new Polygon(xpoints,ypoints,xpoints.length));
System.out.println("OKAY");
System.exit(0);
}
}
======== end of Test37.java ==========================================
======== Output under pbp RI build b13 and pp b39 ====================
java.lang.IllegalArgumentException: setClip(Shape) only supports Rectangle objec
ts
at sun.awt.gtk.GdkGraphics.setClip(Ljava/awt/Shape;)V(Unknown Source)
at Test37.main([Ljava/lang/String;)V(Unknown Source)
======== End of output under pbp RI build b13 and pp b39 =============
======== Output under jdk 1.4===============================
OKAY
======== End of output under jdk 1.4========================
======================================================================
- duplicates
-
JDK-4526048 spec for java.awt.Graphics.setClip(Shape) method is incomplete
-
- Closed
-