changeset 11687:9266c8c8ce7e

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 373d37a63790
children 1cb54d0c113d
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	Fri Oct 16 12:17:36 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
+}