< prev index next >
src/java.desktop/share/classes/sun/print/PrintJob2D.java
Print this page
@@ -629,11 +629,11 @@
attributes.add(new JobName(docTitle, null));
PrintService pServ = printServ;
String printerName = jobAttributes.getPrinter();
if (printerName != null && printerName != ""
- && !printerName.equals(pServ.getName())) {
+ && pServ != null && !printerName.equals(pServ.getName())) {
// Search for the given printerName in the list of PrintServices
PrintService []services = PrinterJob.lookupPrintServices();
try {
for (int i=0; i<services.length; i++) {
@@ -646,11 +646,11 @@
} catch (PrinterException pe) {
}
}
DestinationType dest = jobAttributes.getDestination();
- if (dest == DestinationType.FILE &&
+ if (dest == DestinationType.FILE && pServ != null &&
pServ.isAttributeCategorySupported(Destination.class)) {
String fileName = jobAttributes.getFileName();
Destination defaultDest;
< prev index next >