--- old/src/solaris/classes/sun/print/UnixPrintServiceLookup.java 2014-06-08 21:28:02.000000000 -0700 +++ new/src/solaris/classes/sun/print/UnixPrintServiceLookup.java 2014-06-08 21:28:02.000000000 -0700 @@ -69,7 +69,7 @@ private String defaultPrinter; private PrintService defaultPrintService; private PrintService[] printServices; /* includes the default printer */ - private Vector lookupListeners = null; + private Vector lookupListeners = null; private static String debugPrefix = "UnixPrintServiceLookup>> "; private static boolean pollServices = true; private static final int DEFAULT_MINREFRESH = 120; // 2 minutes @@ -239,7 +239,7 @@ } } - private int addPrintServiceToList(ArrayList printerList, PrintService ps) { + private int addPrintServiceToList(ArrayList printerList, PrintService ps) { int index = printerList.indexOf(ps); // Check if PrintService with same name is already in the list. if (CUPSPrinter.isCupsRunning() && index != -1) { @@ -253,7 +253,7 @@ IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, ignoring the new local printer: "+ps); return index; // Do not add this. } - PrintService oldPS = (PrintService)(printerList.get(index)); + PrintService oldPS = printerList.get(index); uri = oldPS.getAttribute(PrinterURI.class); if (uri.getURI().getHost().equals("localhost")) { IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, removing existing local printer: "+oldPS); @@ -319,7 +319,7 @@ return; } - ArrayList printerList = new ArrayList(); + ArrayList printerList = new ArrayList<>(); int defaultIndex = -1; for (int p=0; p 0) { @@ -411,9 +410,9 @@ PrintServiceAttributeSet attributes) { Attribute [] attrs = attributes.toArray(); - Attribute serviceAttr; for (int i=0; i)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; @@ -542,7 +541,7 @@ } } else { /* specified service attributes don't include a name.*/ - Vector matchedServices = new Vector(); + Vector matchedServices = new Vector<>(); services = getPrintServices(); for (int i = 0; i< services.length; i++) { if (matchesAttributes(services[i], serviceSet)) { @@ -551,7 +550,7 @@ } services = new PrintService[matchedServices.size()]; for (int i = 0; i< services.length; i++) { - services[i] = (PrintService)matchedServices.elementAt(i); + services[i] = matchedServices.elementAt(i); } return services; } @@ -591,7 +590,7 @@ } if (CUPSPrinter.isCupsRunning()) { - ArrayList matchingServices = new ArrayList(); + ArrayList matchingServices = new ArrayList<>(); for (int i=0; i(); lookupListeners.add(listener); Thread lookupThread = new Thread(this); lookupThread.start(); @@ -733,8 +732,7 @@ synchronized (this) { BackgroundLookupListener listener; for (int i=0; i printerNames = new ArrayList<>(); for (int i=0; i < names.length; i++) { if (!names[i].equals("_default") && !names[i].equals(defaultPrinter) && @@ -828,7 +826,7 @@ printerNames.add(names[i]); } } - return (String[])printerNames.toArray(new String[printerNames.size()]); + return printerNames.toArray(new String[printerNames.size()]); } private String getDefaultPrinterNameAIX() { @@ -870,7 +868,7 @@ } static String[] execCmd(final String command) { - ArrayList results = null; + ArrayList results = null; try { final String[] cmd = new String[3]; if (isSysV() || isAIX()) { @@ -883,9 +881,9 @@ cmd[2] = "LC_ALL=C " + command; } - results = (ArrayList)AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Object run() throws IOException { + results = AccessController.doPrivileged( + new PrivilegedExceptionAction>() { + public ArrayList run() throws IOException { Process proc; BufferedReader bufferedReader = null; @@ -907,7 +905,7 @@ FileReader reader = new FileReader(f); bufferedReader = new BufferedReader(reader); String line; - ArrayList results = new ArrayList(); + ArrayList results = new ArrayList<>(); while ((line = bufferedReader.readLine()) != null) { results.add(line); @@ -932,7 +930,7 @@ if (results == null) { return new String[0]; } else { - return (String[])results.toArray(new String[results.size()]); + return results.toArray(new String[results.size()]); } }