8221411: NullPointerException in RasterPrinterJob without PrinterResolution
authorpsadhukhan
Thu, 28 Mar 2019 13:49:27 +0530
changeset 54399 b10e1f4f8b69
parent 54398 62171da145f9
child 54400 31c35004f300
8221411: NullPointerException in RasterPrinterJob without PrinterResolution Reviewed-by: prr
src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
--- 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);