Details
-
Bug
-
Resolution: Fixed
-
P3
-
7u21
-
b102
-
os_x
Description
FULL PRODUCT VERSION :
java version " 1.7.0_21 "
Java (TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot (TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Mathiass-Mac-mini.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
This problem affects only systems with more than one printer.
On the test-system, there is three printers:
CUPS_PDF (default printer)
Samsung_CLP_610
Zebra_TLP2844_2
Regardless of which printer is selected, the print job is sent to the default printer. Debugging confirms that the correct printer is selected.
Read more on: https://forums.oracle.com/message/10525364
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import java.awt.print.PrinterJob;
public class PrintBug {
public static PrintService getPrintServiceByName( String printerName ) {
PrintService[] services = PrintServiceLookup.lookupPrintServices( null, null );
for( PrintService service : services ) {
if( service.getName().compareToIgnoreCase( printerName ) == 0 )
return service;
}
return null;
}
public static void main( String[] args ) throws Exception {
PrinterJob printJob = PrinterJob.getPrinterJob();
/* Code to add some content to print */
printJob.setPrintService( getPrintServiceByName( " MyPrinter " ) );
printJob.print();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Set the default printer on the OS to the printer you wish to use
java version " 1.7.0_21 "
Java (TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot (TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Mathiass-Mac-mini.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
This problem affects only systems with more than one printer.
On the test-system, there is three printers:
CUPS_PDF (default printer)
Samsung_CLP_610
Zebra_TLP2844_2
Regardless of which printer is selected, the print job is sent to the default printer. Debugging confirms that the correct printer is selected.
Read more on: https://forums.oracle.com/message/10525364
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import java.awt.print.PrinterJob;
public class PrintBug {
public static PrintService getPrintServiceByName( String printerName ) {
PrintService[] services = PrintServiceLookup.lookupPrintServices( null, null );
for( PrintService service : services ) {
if( service.getName().compareToIgnoreCase( printerName ) == 0 )
return service;
}
return null;
}
public static void main( String[] args ) throws Exception {
PrinterJob printJob = PrinterJob.getPrinterJob();
/* Code to add some content to print */
printJob.setPrintService( getPrintServiceByName( " MyPrinter " ) );
printJob.print();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Set the default printer on the OS to the printer you wish to use
Attachments
Issue Links
- duplicates
-
JDK-8023749 [macosx] Printing attribute (name) wrong when running under OSX
- Closed
- relates to
-
JDK-8025439 [TEST BUG] [macosx] PrintServiceLookup.lookupPrintServices doesn't work properly since jdk8b105
- Resolved
-
JDK-8022241 [macosx] [PIT] lookupPrintServices() returns one too long array
- Closed