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

Undeclared exception in the javax.print.attribute.HashAttributeSet(AttributeSet)

XMLWordPrintable

    • 2d
    • beta2
    • generic
    • generic



      Name: vtR10009 Date: 03/29/2001


         javax.print.attribute.HashAttributeSet(AttributeSet) throws
      undeclared NullPointerException if the attributes parameter
      is null.

      But API spec (build 1.4.0-internal-b57) reads:
      " ...
      Parameters:
         attributes - Set of attributes from which to initialise this set. If null, an empty
      attribute set is constructed.
      ... "

      This bug causes failure of new JCK test:
      api/javax_print/attribute/HashAttributeSet/index.html#Ctor

      To reproduce the bug run the following test:
      ---------------------- test.java -------------------------------
      import javax.print.attribute.AttributeSet;
      import javax.print.attribute.HashAttributeSet;

      public class test {

          public static void main(String args[]) {

              boolean failed = false;

              try {
                  HashAttributeSet aSet = new HashAttributeSet((AttributeSet) null);

              } catch (NullPointerException 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.NullPointerException
              at javax.print.attribute.HashAttributeSet.<init>(HashAttributeSet.java:207)
              at javax.print.attribute.HashAttributeSet.<init>(HashAttributeSet.java:119)
              at test.main(test.java:11)
      Undeclared:java.lang.NullPointerException
      $ java -version
      java version "1.4.0-internal"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-internal-b57)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b57, 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: