8023045: [MacOSX] PrinterIOException when printing a JComponent
Reviewed-by: bae, jchen
This commit is contained in:
parent
41525a23dc
commit
bce847b2be
@ -339,6 +339,8 @@ public class PSPrinterJob extends RasterPrinterJob {
|
|||||||
*/
|
*/
|
||||||
private static Properties mFontProps = null;
|
private static Properties mFontProps = null;
|
||||||
|
|
||||||
|
private static boolean isMac;
|
||||||
|
|
||||||
/* Class static initialiser block */
|
/* Class static initialiser block */
|
||||||
static {
|
static {
|
||||||
//enable priviledges so initProps can access system properties,
|
//enable priviledges so initProps can access system properties,
|
||||||
@ -347,6 +349,8 @@ public class PSPrinterJob extends RasterPrinterJob {
|
|||||||
new java.security.PrivilegedAction() {
|
new java.security.PrivilegedAction() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
mFontProps = initProps();
|
mFontProps = initProps();
|
||||||
|
String osName = System.getProperty("os.name");
|
||||||
|
isMac = osName.startsWith("Mac");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -473,6 +477,12 @@ public class PSPrinterJob extends RasterPrinterJob {
|
|||||||
PrintService pServ = getPrintService();
|
PrintService pServ = getPrintService();
|
||||||
if (pServ != null) {
|
if (pServ != null) {
|
||||||
mDestination = pServ.getName();
|
mDestination = pServ.getName();
|
||||||
|
if (isMac) {
|
||||||
|
PrintServiceAttributeSet psaSet = pServ.getAttributes() ;
|
||||||
|
if (psaSet != null) {
|
||||||
|
mDestination = psaSet.get(PrinterName.class).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -771,6 +781,12 @@ public class PSPrinterJob extends RasterPrinterJob {
|
|||||||
PrintService pServ = getPrintService();
|
PrintService pServ = getPrintService();
|
||||||
if (pServ != null) {
|
if (pServ != null) {
|
||||||
mDestination = pServ.getName();
|
mDestination = pServ.getName();
|
||||||
|
if (isMac) {
|
||||||
|
PrintServiceAttributeSet psaSet = pServ.getAttributes();
|
||||||
|
if (psaSet != null) {
|
||||||
|
mDestination = psaSet.get(PrinterName.class).toString() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PrinterSpooler spooler = new PrinterSpooler();
|
PrinterSpooler spooler = new PrinterSpooler();
|
||||||
java.security.AccessController.doPrivileged(spooler);
|
java.security.AccessController.doPrivileged(spooler);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user