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

Undeclared exception in the javax.print.event.PrintEvent()

XMLWordPrintable

    • 2d
    • tiger
    • generic
    • generic



      Name: vtR10009 Date: 03/26/2001



          Constructors for javax.print.event.PrintEvent and its
      subclasses(PrintJobAttributeEvent, PrintJobEvent, PrintServiceAttributeEvent)
      throw IllegalArgumentException if the source parameter is null.

      But API spec (build 1.4.0-beta-b56) doesn't declare any run-time exception
      in the throws clause for this constructors.

      This bug causes failures of new JCK tests:
      api/javax_print/event/PrintEvent/index.html#PrintEventTests
      api/javax_print/event/PrintJobEvent/index.html#PrintJobEventTests
      api/javax_print/event/PrintJobAttributeEvent/index.html#PrintJobAttributeEventTests
      api/javax_print/event/PrintServiceAttributeEvent/index.html#PrintServiceAttributeEventTe
      sts

      To reproduce the bug run the following test:
      ---------------------- test.java ------------------------
      import javax.print.event.PrintEvent;
      import javax.print.event.PrintJobAttributeEvent;
      import javax.print.event.PrintServiceAttributeEvent;
      import javax.print.event.PrintJobEvent;

      import javax.print.attribute.HashPrintJobAttributeSet;
      import javax.print.attribute.HashPrintServiceAttributeSet;

      public class test{

          public static void main(String args[])
          {
              boolean failed = false;
              
              try{
                  PrintEvent prEv = new PrintEvent(null);
              }catch (IllegalArgumentException ex){
                  failed=true;
                  ex.printStackTrace();
                  System.out.println("Undeclared:"+ex.toString());
              }
              
              try{
                  HashPrintJobAttributeSet aSet = new HashPrintJobAttributeSet();
                  PrintJobAttributeEvent prEv = new PrintJobAttributeEvent(null,
      aSet);
              }catch (IllegalArgumentException ex){
                  failed=true;
                  ex.printStackTrace();
                  System.out.println("Undeclared:"+ex.toString());
              }
              
              try{
                  HashPrintServiceAttributeSet aSet = new
      HashPrintServiceAttributeSet();
                  PrintServiceAttributeEvent prEv;

                  prEv = new PrintServiceAttributeEvent(null, aSet);
              }catch (IllegalArgumentException ex){
                  failed=true;
                  ex.printStackTrace();
                  System.out.println("Undeclared:"+ex.toString());
              }
              
              try{
                  PrintJobEvent prEv = new PrintJobEvent(null,
      PrintJobEvent.JOB_FAILED);
              }catch (IllegalArgumentException ex){
                  failed=true;
                  ex.printStackTrace();
                  System.out.println("Undeclared:"+ex.toString());
              }

              if (!failed) System.out.println("Ok.");
              
          }
      }
      -------------------------- Logs -----------------------------
      $ javac test.java
      $ java test
      java.lang.IllegalArgumentException: null source
              at java.util.EventObject.<init>(EventObject.java:37)
              at javax.print.event.PrintEvent.<init>(PrintEvent.java:25)
              at test.main(test.java:16)
      Undeclared:java.lang.IllegalArgumentException: null source
      java.lang.IllegalArgumentException: null source
              at java.util.EventObject.<init>(EventObject.java:37)
              at javax.print.event.PrintEvent.<init>(PrintEvent.java:25)
              at
      javax.print.event.PrintJobAttributeEvent.<init>(PrintJobAttributeEvent.java:34)
              at test.main(test.java:25)
      Undeclared:java.lang.IllegalArgumentException: null source
      java.lang.IllegalArgumentException: null source
              at java.util.EventObject.<init>(EventObject.java:37)
              at javax.print.event.PrintEvent.<init>(PrintEvent.java:25)
              at
      javax.print.event.PrintServiceAttributeEvent.<init>(PrintServiceAttributeEvent.j
      ava:38)
              at test.main(test.java:36)
      Undeclared:java.lang.IllegalArgumentException: null source
      java.lang.IllegalArgumentException: null source
              at java.util.EventObject.<init>(EventObject.java:37)
              at javax.print.event.PrintEvent.<init>(PrintEvent.java:25)
              at javax.print.event.PrintJobEvent.<init>(PrintJobEvent.java:74)
              at test.main(test.java:44)
      Undeclared:java.lang.IllegalArgumentException: null source
      $ java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b56)
      Java HotSpot(TM) Client VM (build 1.4-beta-B56, mixed mode)
      ----------------------------------------------------------------

      ======================================================================

            jgodinez Jennifer Godinez (Inactive)
            vitcsunw Vitc Vitc (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: