changeset 55673:b10e1f4f8b69

8221411: NullPointerException in RasterPrinterJob without PrinterResolution Reviewed-by: prr
author psadhukhan
date Thu, 28 Mar 2019 13:49:27 +0530
parents 62171da145f9
children 31c35004f300
files src/java.desktop/share/classes/sun/print/RasterPrinterJob.java
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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);