src/solaris/classes/sun/print/UnixPrintServiceLookup.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -198,11 +198,11 @@
refreshServices();
}
if (printServices == null) {
return new PrintService[0];
} else {
- return (PrintService[])printServices.clone();
+ return printServices.clone();
}
}
private int addPrintServiceToList(ArrayList printerList, PrintService ps) {
int index = printerList.indexOf(ps);
@@ -211,17 +211,17 @@
// Bug in Linux: Duplicate entry of a remote printer
// and treats it as local printer but it is returning wrong
// information when queried using IPP. Workaround is to remove it.
// Even CUPS ignores these entries as shown in lpstat or using
// their web configuration.
- PrinterURI uri = (PrinterURI)ps.getAttribute(PrinterURI.class);
+ PrinterURI uri = ps.getAttribute(PrinterURI.class);
if (uri.getURI().getHost().equals("localhost")) {
IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, ignoring the new local printer: "+ps);
return index; // Do not add this.
}
PrintService oldPS = (PrintService)(printerList.get(index));
- uri = (PrinterURI)oldPS.getAttribute(PrinterURI.class);
+ uri = oldPS.getAttribute(PrinterURI.class);
if (uri.getURI().getHost().equals("localhost")) {
IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, removing existing local printer: "+oldPS);
printerList.remove(oldPS);
} else {
return index;
@@ -408,12 +408,11 @@
return null;
}
/* check if all printers are already available */
if (printServices != null) {
for (PrintService printService : printServices) {
- PrinterName printerName =
- (PrinterName)printService.getAttribute(PrinterName.class);
+ PrinterName printerName = printService.getAttribute(PrinterName.class);
if (printerName.getValue().equals(name)) {
return printService;
}
}
}
@@ -462,12 +461,11 @@
/* To avoid execing a unix command see if the client is asking
* for the default printer by name, since we already have that
* initialised.
*/
- PrinterName defName =
- (PrinterName)defService.getAttribute(PrinterName.class);
+ PrinterName defName = defService.getAttribute(PrinterName.class);
if (defName != null && name.equals(defName)) {
if (matchesAttributes(defService, serviceSet)) {
services = new PrintService[1];
services[0] = defService;