# HG changeset patch # User jgodinez # Date 1376592993 25200 # Node ID e5a4f2784bf226238a26b1b4cf1490da35adfee4 # Parent 30a1d677a20c6a95f98043d8f20ce570304e3818 8023045: [MacOSX] PrinterIOException when printing a JComponent Reviewed-by: bae, jchen diff -r 30a1d677a20c -r e5a4f2784bf2 jdk/src/share/classes/sun/print/PSPrinterJob.java --- a/jdk/src/share/classes/sun/print/PSPrinterJob.java Wed Jul 05 19:07:31 2017 +0200 +++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java Thu Aug 15 11:56:33 2013 -0700 @@ -339,6 +339,8 @@ */ private static Properties mFontProps = null; + private static boolean isMac; + /* Class static initialiser block */ static { //enable priviledges so initProps can access system properties, @@ -347,6 +349,8 @@ new java.security.PrivilegedAction() { public Object run() { mFontProps = initProps(); + String osName = System.getProperty("os.name"); + isMac = osName.startsWith("Mac"); return null; } }); @@ -473,6 +477,12 @@ PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); + if (isMac) { + PrintServiceAttributeSet psaSet = pServ.getAttributes() ; + if (psaSet != null) { + mDestination = psaSet.get(PrinterName.class).toString(); + } + } } } } @@ -771,6 +781,12 @@ PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); + if (isMac) { + PrintServiceAttributeSet psaSet = pServ.getAttributes(); + if (psaSet != null) { + mDestination = psaSet.get(PrinterName.class).toString() ; + } + } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler);