< prev index next >

## src/com/sun/javatest/agent/Agent.java

Print this page

    @@ -201,12 +201,12 @@
                 if (map == null)
                     traceOut.println("set map null");
                 else {
                     traceOut.println("set map:");
                     map.setTracing(tracing, traceOut);
    -                for (Enumeration e = map.enumerate(); e.hasMoreElements(); ) {
    -                    String[] entry = (String[])(e.nextElement());
    +                for (Enumeration<String[]> e = map.enumerate(); e.hasMoreElements(); ) {
    +                    String[] entry = e.nextElement();
                         traceOut.println("map-from: " + entry[0]);
                         traceOut.println("map-to:   " + entry[1]);
                     }
                     traceOut.println("end of map");
                 }

    @@ -333,11 +333,11 @@
         public synchronized void close() throws InterruptedException {
             closing = true;  // will prevent new tasks from being created

             // interrupt any threads that are running
             for (int i = 0; i < threads.size(); i++) {
    -            Thread t = (Thread)(threads.elementAt(i));
    +            Thread t = threads.elementAt(i);
                 if (tracing)
                     traceOut.println("INTERRUPTING THREAD " + t.getName());
                 t.interrupt();
             }

    @@ -345,11 +345,11 @@
             traceOut.println("WAITING 3s FOR THREADS TO CLEANUP");
             Thread.currentThread().sleep(3000);

             // close any tasks that are running
             for (int i = 0; i < tasks.size(); i++) {
    -            Task t = (Task)(tasks.elementAt(i));
    +            Task t = tasks.elementAt(i);
                 if (tracing) {
                     Connection c = t.connection; // maybe null; if it is, task is already closing
                     traceOut.println("CLOSING TASK " + (c == null ? "[unknown]" : c.getName()));
                 }
                 t.close();

    @@ -540,12 +540,12 @@
         }

         private boolean closing;
         private Thread mainThread;
         private int maxThreads;
    -    private Vector threads = new Vector();
    -    private Vector tasks = new Vector();
    +    private Vector<Thread> threads = new Vector<>();
    +    private Vector<Task> tasks = new Vector<>();
         private Notifier notifier = new Notifier();
         private Object currSystemStreamOwner = null;
         private PrintStream saveOut;
         private PrintStream saveErr;

    @@ -934,11 +934,11 @@
                     return result;
                 }

             }

    -        private Status executeMain(Class c, String[] args,
    +        private Status executeMain(Class<?> c, String[] args,
                     PrintWriter testLog, PrintWriter testRef)
                     throws IOException, ClassNotFoundException, IllegalAccessException {
                 notifier.execMain(connection, tag, c.getName(), args);

                 PrintStream out = Deprecated.createPrintStream(new WriterStream(testRef));

    @@ -1105,11 +1105,11 @@
                 return data;
             }

             private ClassLoader getAgentClassLoader(boolean useSharedClassLoader)
                     throws InstantiationException, IllegalAccessException {
    -            Class classLoaderClass;
    +            Class<?> classLoaderClass;
                 try {
                     String s = getClass().getName();
                     String pkg = s.substring(0, s.lastIndexOf('.'));
                     classLoaderClass = Class.forName(pkg + ".AgentClassLoader2");
                 } catch (Throwable t) {

< prev index next >