JDK-8212202 : [Windows] Exception if no printers are installed.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8u212,11,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: generic
  • Submitted: 2018-10-15
  • Updated: 2020-01-13
  • Resolved: 2019-02-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 7 JDK 8 Other
11.0.4Fixed 7u241Fixed 8u212Fixed openjdk8u222Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
A number of tests fails with NPE after JDK-8153732
Example:
javax/print/TextFlavorTest.java
----------System.out:(1/25)----------
No print service found.
----------System.err:(6/479)----------
java.lang.NullPointerException
	at java.desktop/sun.print.PrintServiceLookupProvider$RemotePrinterChangeListener.doCompare(PrintServiceLookupProvider.java:413)
	at java.desktop/sun.print.PrintServiceLookupProvider$RemotePrinterChangeListener.run(PrintServiceLookupProvider.java:432)
	at java.base/java.lang.Thread.run(Thread.java:835)

Comments
Please post patches for review to the jdk8u mailing list and don't add jdk8u-fix-request until review is complete. Thanks.
28-05-2019

8u backport Webrev: http://cr.openjdk.java.net/~zgu/JDK-8212202-8u/webrev.00/
25-05-2019

Fix Request: I would like to backport this change to openjdk 8u. It is part of the Oracle updates as well. Patch applies cleanly.
25-05-2019

Fix Request: Issue needs to be brought to OpenJDK11u, because it's in Oracle 11.0.4. Patch applies cleanly and runs through test system at SAP.
07-05-2019

Typically there are always some printer would be associated with the system like Microsoft print to pdf, fax, send to onenote...etc. One has to specifically delete all those printers manually to reproduce this issue. So I see it as a corner case though. But am not sure Victor.
17-12-2018

Is it a real P2 ?
14-12-2018

Though the issue was not reproducible but a fix is required to handle the null return values caller of the function getRemotePrintersNames() end. Hence the code is adding additional null pointer check in the original implementation of bug JDK-8153732. Test is already present as part of fix for the bug JDK-8153732.
26-11-2018

Based on this line: http://hg.openjdk.java.net/jdk/jdk/rev/732a3b600098#l2.51 I assume that it is enouth to run any of these test like: java/awt/print/PageFormat/PageFormatFromAttributes.java On the system w/o printer.
21-11-2018

Hi Sergey, Please provide steps to reproduce this problem.
21-11-2018

Unable to reproduce this issue on multiple systems.
20-11-2018

I am getting timeout error and not NPE. I tested it on Windows 10 Pro and latest JDK. But thro' code walk I see the scenario where it can be null and can throw NPE.
13-11-2018

And some others: Test starting: java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java Test finished: java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java Test finished: java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java Test finished: java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java Test finished: java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java Test finished: java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java Test finished: java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java Test finished: java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java Test finished: java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException
15-10-2018

Most of the test from the java.print: Test starting: java/awt/print/PageFormat/PageFormatFromAttributes.java Test finished: java/awt/print/PageFormat/PageFormatFromAttributes.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java Test finished: java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/CheckPrivilege.java Test finished: java/awt/print/PrinterJob/CheckPrivilege.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/DeviceScale.java Test finished: java/awt/print/PrinterJob/DeviceScale.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/DummyPrintTest.java Test finished: java/awt/print/PrinterJob/DummyPrintTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/ExceptionTest.java Test finished: java/awt/print/PrinterJob/ExceptionTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/HeadlessPrintingTest.java Test finished: java/awt/print/PrinterJob/HeadlessPrintingTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/LandscapeStackOverflow.java Test finished: java/awt/print/PrinterJob/LandscapeStackOverflow.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/PaintText.java Test finished: java/awt/print/PrinterJob/PaintText.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/PrintCrashTest.java Test finished: java/awt/print/PrinterJob/PrintCrashTest.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/PrintTextPane.java Test finished: java/awt/print/PrinterJob/PrintTextPane.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/PrintToDir.java Test finished: java/awt/print/PrinterJob/PrintToDir.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/PrtException.java Test finished: java/awt/print/PrinterJob/PrtException.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/RemoveListener.java Test finished: java/awt/print/PrinterJob/RemoveListener.java: Failed. Execution failed: STATUS:Failed.`main' threw exception: java.lang.NullPointerException Test starting: java/awt/print/PrinterJob/SameService.java Test finished: java/awt/print/PrinterJob/SameService.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/PrintJob/MultipleEnd/MultipleEnd.java Test finished: java/awt/PrintJob/MultipleEnd/MultipleEnd.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException Test starting: java/awt/PrintJob/PrinterException.java Test finished: java/awt/PrintJob/PrinterException.java: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException
15-10-2018