8221411: NullPointerException in RasterPrinterJob without PrinterResolution
Reviewed-by: prr
--- a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Thu Mar 28 13:47:10 2019 +0530
+++ b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Thu Mar 28 13:49:27 2019 +0530
@@ -1275,10 +1275,12 @@
printerResAttr = (PrinterResolution)
service.getDefaultAttributeValue(PrinterResolution.class);
}
- double xr =
- printerResAttr.getCrossFeedResolution(ResolutionSyntax.DPI);
- double yr = printerResAttr.getFeedResolution(ResolutionSyntax.DPI);
- setXYRes(xr, yr);
+ if (printerResAttr != null) {
+ double xr =
+ printerResAttr.getCrossFeedResolution(ResolutionSyntax.DPI);
+ double yr = printerResAttr.getFeedResolution(ResolutionSyntax.DPI);
+ setXYRes(xr, yr);
+ }
}
pageRangesAttr = (PageRanges)attributes.get(PageRanges.class);