changeset 11326:d4f2c6280868

8132988: Better printing dialogues Reviewed-by: van, vadim Contributed-by: nakul.natu@oracle.com
author asaha
date Wed, 21 Oct 2015 00:21:57 -0700
parents e1385aad7740
children 43325651ebb8
files src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Mon Oct 19 16:41:17 2015 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Wed Oct 21 00:21:57 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -234,6 +234,11 @@
         // this will not work if the user clicks on the "Preview" button
         // However if the printer is a StreamPrintService, its the right path.
         PrintService psvc = getPrintService();
+
+        if (psvc == null) {
+            throw new PrinterException("No print service found.");
+        }
+
         if (psvc instanceof StreamPrintService) {
             spoolToService(psvc, attributes);
             return;
@@ -775,4 +780,4 @@
                 (float) (paper.getImageableHeight() / dpi),
                 MediaPrintableArea.INCH);
     }
-}
\ No newline at end of file
+}