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

DocPrintJob.removePrintJobAttributeListener() throws NullPointerException unexpe

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      beta2
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: ooR10006 Date: 05/17/2001


      jdk1.4.0beta-b64:
      javax.print.DocPrintJob.removePrintJobAttributeListener(listener) throws
      NullPointerException trying to remove registered listener.

      The spec for the method removePrintJobAttributeListener(listener) says:
      "Removes an attribute listener from this print job. This method performs no function,
      nor does it throw an exception, if the listener specified by the argument was not
      previously added to this component..."

      The following simple test shows the failure:

      import javax.print.*;
      import javax.print.attribute.*;
      import javax.print.event.*;
      import javax.print.attribute.standard.*;

      public class test {
          public static void main(String[] args){
              PrintService[] pservices = PrintServiceLookup.lookupPrintServices(null, null);
              if (pservices.length == 0){
                  return;
              }
              DocPrintJob pj = pservices[0].createPrintJob();
              PrintJobAttributeSet aset = new HashPrintJobAttributeSet();
              aset.add(JobState.PROCESSING);
              PrintJobAttributeListener listener = new PJAListener();
              pj.addPrintJobAttributeListener(listener, aset);
              pj.removePrintJobAttributeListener(listener);
              return;
          }
      }

      class PJAListener implements PrintJobAttributeListener {
          public void attributeUpdate(PrintJobAttributeEvent pjae){
              return;
          }
      }

      % jdk1.4.0beta-b64/solsparc/bin/java test
      Exception in thread "main" java.lang.NullPointerException
              at sun.print.UnixPrintJob.removePrintJobAttributeListener(UnixPrintJob.java:262)
              at test.main(test.java:19)
      %

      Due to this new JCK merlin test fails:
      api/javax_print/DocPrintJob/index.html#AttributeListener[DocPrintJob2009]

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

        Attachments

          Activity

            People

            • Assignee:
              jgodinez Jennifer Godinez (Inactive)
              Reporter:
              ovosunw Ovo Ovo (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: