-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
generic
-
generic
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]
======================================================================