-
Bug
-
Resolution: Fixed
-
P3
-
11.0.2
-
b15
-
x86_64
-
windows_10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8223524 | 11.0.5-oracle | Prasanta Sadhukhan | P3 | Resolved | Fixed | b01 |
JDK-8226926 | 11.0.5 | Prasanta Sadhukhan | P3 | Resolved | Fixed | b01 |
ADDITIONAL SYSTEM INFORMATION :
Windows 10, OpenJDK 64-Bit Server VM 11.0.2
A DESCRIPTION OF THE PROBLEM :
Printing to HP Deskjet 1510 printer fails with
java.lang.NullPointerException
at java.desktop/sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1280)
at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(WPrinterJob.java:696)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1550)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1483)
This problem has been reported before as https://bugs.openjdk.java.net/browse/JDK-8186987 and has been and currently still is marked as fixed for Java 10. However, the error still occurs for Java 11! This is not much of a surprise, because the inital fix http://hg.openjdk.java.net/jdk10/client/jdk/file/dbb5b171a16b/src/java.desktop/windows/classes/sun/print/Win32PrintService.java#l1189 has been stripped from the corresponding repository! I think you should at least re-open issues if you strip away the corresponding fixes.
Finally, a very simple fix for this issue would be:
src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
1279,1282c1279,1284
< double xr =
< printerResAttr.getCrossFeedResolution(ResolutionSyntax.DPI);
< double yr = printerResAttr.getFeedResolution(ResolutionSyntax.DPI);
< setXYRes(xr, yr);
---
> if (isSupportedValue(printerResAttr, attributes)) {
> double xr =
> printerResAttr.getCrossFeedResolution(ResolutionSyntax.DPI);
> double yr = printerResAttr.getFeedResolution(ResolutionSyntax.DPI);
> setXYRes(xr, yr);
> }
REGRESSION : Last worked in version 8u201
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
see https://bugs.openjdk.java.net/browse/JDK-8186987
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
see https://bugs.openjdk.java.net/browse/JDK-8186987
ACTUAL -
see https://bugs.openjdk.java.net/browse/JDK-8186987
---------- BEGIN SOURCE ----------
see https://bugs.openjdk.java.net/browse/JDK-8186987
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
see https://bugs.openjdk.java.net/browse/JDK-8186987
FREQUENCY : always
Windows 10, OpenJDK 64-Bit Server VM 11.0.2
A DESCRIPTION OF THE PROBLEM :
Printing to HP Deskjet 1510 printer fails with
java.lang.NullPointerException
at java.desktop/sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1280)
at java.desktop/sun.awt.windows.WPrinterJob.setAttributes(WPrinterJob.java:696)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1550)
at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1483)
This problem has been reported before as https://bugs.openjdk.java.net/browse/JDK-8186987 and has been and currently still is marked as fixed for Java 10. However, the error still occurs for Java 11! This is not much of a surprise, because the inital fix http://hg.openjdk.java.net/jdk10/client/jdk/file/dbb5b171a16b/src/java.desktop/windows/classes/sun/print/Win32PrintService.java#l1189 has been stripped from the corresponding repository! I think you should at least re-open issues if you strip away the corresponding fixes.
Finally, a very simple fix for this issue would be:
src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
1279,1282c1279,1284
< double xr =
< printerResAttr.getCrossFeedResolution(ResolutionSyntax.DPI);
< double yr = printerResAttr.getFeedResolution(ResolutionSyntax.DPI);
< setXYRes(xr, yr);
---
> if (isSupportedValue(printerResAttr, attributes)) {
> double xr =
> printerResAttr.getCrossFeedResolution(ResolutionSyntax.DPI);
> double yr = printerResAttr.getFeedResolution(ResolutionSyntax.DPI);
> setXYRes(xr, yr);
> }
REGRESSION : Last worked in version 8u201
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
see https://bugs.openjdk.java.net/browse/JDK-8186987
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
see https://bugs.openjdk.java.net/browse/JDK-8186987
ACTUAL -
see https://bugs.openjdk.java.net/browse/JDK-8186987
---------- BEGIN SOURCE ----------
see https://bugs.openjdk.java.net/browse/JDK-8186987
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
see https://bugs.openjdk.java.net/browse/JDK-8186987
FREQUENCY : always
- backported by
-
JDK-8223524 NullPointerException in RasterPrinterJob without PrinterResolution
- Resolved
-
JDK-8226926 NullPointerException in RasterPrinterJob without PrinterResolution
- Resolved
- duplicates
-
JDK-8223428 NullPointerException in RasterPrinterJob
- Closed
- relates to
-
JDK-8186987 NullPointerException in RasterPrinterJob without PrinterResolution
- Resolved