Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4531136

Graphics.setClip() throws IllegalArgumentException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Component/s: docs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_7

      Description



      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========================
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              duke J. Duke (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: