Author: andygumbrecht
Date: Wed Apr 11 08:38:46 2012
New Revision: 1324635

URL: http://svn.apache.org/viewvc?rev=1324635&view=rev
Log:
Fix StandaloneServer for win platforms - Was throwing FileNotFound on 'java' 
when 'java.exe' was required.
Formatting. Finals.

Modified:
    
openejb/trunk/openejb/itests/failover/src/main/java/org/apache/openejb/server/control/StandaloneServer.java
    
openejb/trunk/openejb/itests/failover/src/test/java/org/apache/openejb/itest/failover/RandomConnectionStrategyTest.java
    
openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/RemoteTestServer.java
    
openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TomcatRemoteTestServer.java
    
openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/Response.java
    
openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/Start.java

Modified: 
openejb/trunk/openejb/itests/failover/src/main/java/org/apache/openejb/server/control/StandaloneServer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/itests/failover/src/main/java/org/apache/openejb/server/control/StandaloneServer.java?rev=1324635&r1=1324634&r2=1324635&view=diff
==============================================================================
--- 
openejb/trunk/openejb/itests/failover/src/main/java/org/apache/openejb/server/control/StandaloneServer.java
 (original)
+++ 
openejb/trunk/openejb/itests/failover/src/main/java/org/apache/openejb/server/control/StandaloneServer.java
 Wed Apr 11 08:38:46 2012
@@ -33,15 +33,12 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
-import static org.apache.openejb.loader.Files.dir;
-import static org.apache.openejb.loader.Files.exists;
-import static org.apache.openejb.loader.Files.file;
-import static org.apache.openejb.loader.Files.readable;
-import static org.apache.openejb.loader.Files.select;
+import static org.apache.openejb.loader.Files.*;
 
 /**
  * @version $Rev$ $Date$
  */
+@SuppressWarnings({"UnusedDeclaration"})
 public class StandaloneServer {
 
     private final File home;
@@ -73,7 +70,9 @@ public class StandaloneServer {
 
         final File javaHome = readable(dir(exists(new 
File(System.getProperty("java.home")))));
 
-        java = readable(file(Files.path(javaHome, "bin", "java")));
+        final boolean isWindows = 
System.getProperty("os.name").toLowerCase().contains("win");
+
+        java = readable(file(Files.path(javaHome, "bin", isWindows ? 
"java.exe" : "java")));
 
         jvmOpts.add("-XX:+HeapDumpOnOutOfMemoryError");
         jvmOpts.add("-javaagent:" + javaagentJar.getAbsolutePath());
@@ -84,7 +83,8 @@ public class StandaloneServer {
      * with this server.  Does not affect the running server
      * and none of these objects are in any way sent or part
      * of the server itself.
-     * @return
+     *
+     * @return Context
      */
     public Context getContext() {
         return context;
@@ -381,6 +381,7 @@ public class StandaloneServer {
                             server.process.destroy();
                         }
                     } catch (Throwable e) {
+                        //Ignore
                     }
                 }
             }

Modified: 
openejb/trunk/openejb/itests/failover/src/test/java/org/apache/openejb/itest/failover/RandomConnectionStrategyTest.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/itests/failover/src/test/java/org/apache/openejb/itest/failover/RandomConnectionStrategyTest.java?rev=1324635&r1=1324634&r2=1324635&view=diff
==============================================================================
--- 
openejb/trunk/openejb/itests/failover/src/test/java/org/apache/openejb/itest/failover/RandomConnectionStrategyTest.java
 (original)
+++ 
openejb/trunk/openejb/itests/failover/src/test/java/org/apache/openejb/itest/failover/RandomConnectionStrategyTest.java
 Wed Apr 11 08:38:46 2012
@@ -102,7 +102,7 @@ public class RandomConnectionStrategyTes
         Client.addEventObserver(services);
 
         final Map<String, StandaloneServer> servers = new HashMap<String, 
StandaloneServer>();
-        for (String name : new String[]{"red", "green", "blue"}) {
+        for (final String name : new String[]{"red", "green", "blue"}) {
 
             final File home = new File(dir, name);
             Files.mkdir(home);
@@ -154,7 +154,7 @@ public class RandomConnectionStrategyTes
         final InitialContext context = new InitialContext(environment);
         final Calculator bean = (Calculator) 
context.lookup("CalculatorBeanRemote");
 
-        for (Map.Entry<String, StandaloneServer> entry : servers.entrySet()) {
+        for (final Map.Entry<String, StandaloneServer> entry : 
servers.entrySet()) {
             final String name = entry.getKey();
             final StandaloneServer server = entry.getValue();
             final URI serverURI = server.getContext().get(URI.class);
@@ -183,7 +183,7 @@ public class RandomConnectionStrategyTes
         }
 
 
-        for (Map.Entry<String, StandaloneServer> entry : servers.entrySet()) {
+        for (final Map.Entry<String, StandaloneServer> entry : 
servers.entrySet()) {
             final String name = entry.getKey();
             final StandaloneServer server = entry.getValue();
             final URI serverURI = server.getContext().get(URI.class);
@@ -201,28 +201,28 @@ public class RandomConnectionStrategyTes
         }
     }
 
-    private void assertBalance(Calculator bean, int size) {
+    private void assertBalance(final Calculator bean, final int size) {
         final int expectedInvocations = 1000;
         final double percent = 0.10;
         final int totalInvocations = size * expectedInvocations;
 
 
         // Verify the work reached all servers
-        Set<Map.Entry<String, AtomicInteger>> entries = invoke(bean, 
totalInvocations).entrySet();
+        final Set<Map.Entry<String, AtomicInteger>> entries = invoke(bean, 
totalInvocations).entrySet();
 
         Assert.assertEquals(size, entries.size());
 
         // And each server got a minimum of %10 percent of the traffic
-        for (Map.Entry<String, AtomicInteger> entry : entries) {
+        for (final Map.Entry<String, AtomicInteger> entry : entries) {
 
             final int actualInvocations = entry.getValue().get();
 
-            Assert.assertTrue(String.format("%s out of %s is too low", 
actualInvocations, expectedInvocations), actualInvocations > 
expectedInvocations * percent );
+            Assert.assertTrue(String.format("%s out of %s is too low", 
actualInvocations, expectedInvocations), actualInvocations > 
expectedInvocations * percent);
         }
     }
 
 
-    private Map<String, AtomicInteger> invoke(Calculator bean, int max) {
+    private Map<String, AtomicInteger> invoke(final Calculator bean, final int 
max) {
         final Map<String, AtomicInteger> invocations = new HashMap<String, 
AtomicInteger>();
         for (int i = 0; i < max; i++) {
             final String name = bean.name();
@@ -234,7 +234,7 @@ public class RandomConnectionStrategyTes
             invocations.get(name).incrementAndGet();
         }
 
-        for (Map.Entry<String, AtomicInteger> entry : invocations.entrySet()) {
+        for (final Map.Entry<String, AtomicInteger> entry : 
invocations.entrySet()) {
             logger.info(String.format("Server %s invoked %s times", 
entry.getKey(), entry.getValue()));
         }
 
@@ -256,15 +256,15 @@ public class RandomConnectionStrategyTes
             return expected;
         }
 
-        public boolean add(URI uri) {
+        public boolean add(final URI uri) {
             return expected.add(uri);
         }
 
-        public boolean remove(URI o) {
+        public boolean remove(final URI o) {
             return expected.remove(o);
         }
 
-        public void observe(@Observes ClusterMetaDataUpdated updated) {
+        public void observe(@Observes final ClusterMetaDataUpdated updated) {
             final URI[] locations = 
updated.getClusterMetaData().getLocations();
             final Set<URI> found = new HashSet<URI>(Arrays.asList(locations));
 
@@ -278,20 +278,20 @@ public class RandomConnectionStrategyTes
             }
         }
 
-        public Set<URI> diff(Set<URI> a, Set<URI> b) {
+        public Set<URI> diff(final Set<URI> a, final Set<URI> b) {
             final Set<URI> diffs = new HashSet<URI>();
-            for (URI uri : b) {
+            for (final URI uri : b) {
                 if (!a.contains(uri)) diffs.add(uri);
             }
 
             return diffs;
         }
 
-        public void assertServices(long timeout, TimeUnit unit, Callable 
callable) {
+        public void assertServices(final long timeout, final TimeUnit unit, 
final Callable callable) {
             assertServices(timeout, unit, callable, 10);
         }
 
-        public void assertServices(long timeout, TimeUnit unit, Callable 
callable, int delay) {
+        public void assertServices(final long timeout, final TimeUnit unit, 
final Callable callable, final int delay) {
             final ClientThread client = new ClientThread(callable);
             client.delay(delay);
             client.start();
@@ -305,7 +305,7 @@ public class RandomConnectionStrategyTes
             }
         }
 
-        public boolean await(long timeout, TimeUnit unit) throws 
InterruptedException {
+        public boolean await(final long timeout, final TimeUnit unit) throws 
InterruptedException {
             lock.lock();
             try {
                 return condition.await(timeout, unit);
@@ -318,7 +318,7 @@ public class RandomConnectionStrategyTes
     private static class CalculatorCallable implements Callable {
         private final Calculator bean;
 
-        public CalculatorCallable(Calculator bean) {
+        public CalculatorCallable(final Calculator bean) {
             this.bean = bean;
         }
 

Modified: 
openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/RemoteTestServer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/RemoteTestServer.java?rev=1324635&r1=1324634&r2=1324635&view=diff
==============================================================================
--- 
openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/RemoteTestServer.java
 (original)
+++ 
openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/RemoteTestServer.java
 Wed Apr 11 08:38:46 2012
@@ -17,9 +17,6 @@
 package org.apache.openejb.test;
 
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.Socket;
@@ -38,7 +35,8 @@ public class RemoteTestServer implements
 
     private Properties properties;
 
-    public void init(Properties props) {
+    @Override
+    public void init(final Properties props) {
         properties = props;
         if (props.contains("java.naming.security.principal")) throw new 
IllegalArgumentException("Not allowed 'java.naming.security.principal'");
 //        
props.put("test.server.class","org.apache.openejb.test.RemoteTestServer");
@@ -48,64 +46,60 @@ public class RemoteTestServer implements
 //        props.put("java.naming.security.credentials", "testpassword");
     }
 
-    public Properties getProperties() {
-        return properties;
-    }
-
-    public void destroy() {
-    }
-
+    @Override
     public void start() {
         if (!connect()) {
             try {
                 System.out.println("[] START SERVER");
 
-                String openejbHome = System.getProperty("openejb.home");
+                final String openejbHome = System.getProperty("openejb.home");
 
-                File home = new File(openejbHome);
-                System.out.println("OPENEJB_HOME = "+home.getAbsolutePath());
-                String systemInfo = "Java " + 
System.getProperty("java.version") + "; " + System.getProperty("os.name") + "/" 
+ System.getProperty("os.version");
-                System.out.println("SYSTEM_INFO  = "+systemInfo);
+                final File home = new File(openejbHome);
+                System.out.println("OPENEJB_HOME = " + home.getAbsolutePath());
+                final String systemInfo = "Java " + 
System.getProperty("java.version") + "; " + System.getProperty("os.name") + "/" 
+ System.getProperty("os.version");
+                System.out.println("SYSTEM_INFO  = " + systemInfo);
 
                 serverHasAlreadyBeenStarted = false;
-                String version = null;
 
                 File openejbJar = null;
-                File lib = new File(home, "lib");
-                File[] files = lib.listFiles();
+                final File lib = new File(home, "lib");
+                final File[] files = lib.listFiles();
                 for (int i = 0; i < files.length && openejbJar == null; i++) {
-                    File file = files[i];
-                    if (file.getName().startsWith("openejb-core") && 
file.getName().endsWith("jar")){
+                    final File file = files[i];
+                    if (file.getName().startsWith("openejb-core") && 
file.getName().endsWith("jar")) {
                         openejbJar = file;
                     }
                 }
 
-                if (openejbJar == null){
-                    throw new IllegalStateException("Cannot find the 
openejb-core jar in "+lib.getAbsolutePath());
+                if (openejbJar == null) {
+                    throw new IllegalStateException("Cannot find the 
openejb-core jar in " + lib.getAbsolutePath());
                 }
-                
+
                 //File openejbJar = new File(lib, "openejb-core-" + version + 
".jar");
 
+                //Not really required here for exec, but as a reminder that we 
run on all platforms
+                final boolean isWindows = 
System.getProperty("os.name").toLowerCase().contains("win");
+
                 //DMB: If you don't use an array, you get problems with jar 
paths containing spaces
                 // the command won't parse correctly
-                String[] args = {"java", "-jar", openejbJar.getAbsolutePath(), 
"start"};
-                Process server = Runtime.getRuntime().exec(args);
+                final String[] args = {(isWindows ? "java.exe" : "java"), 
"-jar", openejbJar.getAbsolutePath(), "start"};
+                final Process server = Runtime.getRuntime().exec(args);
 
                 // Pipe the processes STDOUT to ours
-                InputStream out = server.getInputStream();
-                Thread serverOut = new Thread(new Pipe(out, System.out));
+                final InputStream out = server.getInputStream();
+                final Thread serverOut = new Thread(new Pipe(out, System.out));
 
                 serverOut.setDaemon(true);
                 serverOut.start();
 
                 // Pipe the processes STDERR to ours
-                InputStream err = server.getErrorStream();
-                Thread serverErr = new Thread(new Pipe(err, System.err));
+                final InputStream err = server.getErrorStream();
+                final Thread serverErr = new Thread(new Pipe(err, System.err));
 
                 serverErr.setDaemon(true);
                 serverErr.start();
             } catch (Exception e) {
-                throw (RuntimeException)new RuntimeException("Cannot start the 
server.").initCause(e);
+                throw (RuntimeException) new RuntimeException("Cannot start 
the server.").initCause(e);
             }
             connect(10);
         } else {
@@ -113,75 +107,14 @@ public class RemoteTestServer implements
         }
     }
 
-    private void oldStart() throws IOException, FileNotFoundException {
-        String s = java.io.File.separator;
-        String java = System.getProperty("java.home") + s + "bin" + s + "java";
-        String classpath = System.getProperty("java.class.path");
-        String openejbHome = System.getProperty("openejb.home");
-
-
-        String[] cmd = new String[ 5 ];
-        cmd[0] = java;
-        cmd[1] = "-classpath";
-        cmd[2] = classpath;
-        cmd[3] = "-Dopenejb.home=" + openejbHome;
-        cmd[4] = "org.apache.openejb.server.Main";
-        for (int i = 0; i < cmd.length; i++) {
-            //System.out.println("[] "+cmd[i]);
-        }
-
-        Process remoteServerProcess = Runtime.getRuntime().exec(cmd);
-
-        // it seems as if OpenEJB wouldn't start up till the output stream was 
read
-        final java.io.InputStream is = remoteServerProcess.getInputStream();
-        final java.io.OutputStream out = new 
FileOutputStream("logs/testsuite.out");
-        Thread serverOut = new Thread(new Runnable() {
-            public void run() {
-                try {
-                    //while ( is.read() != -1 );
-                    int i = is.read();
-                    out.write(i);
-                    while (i != -1) {
-                        //System.out.write( i );
-                        i = is.read();
-                        out.write(i);
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        });
-        serverOut.setDaemon(true);
-        serverOut.start();
-
-        final java.io.InputStream is2 = remoteServerProcess.getErrorStream();
-        Thread serverErr = new Thread(new Runnable() {
-            public void run() {
-                try {
-                    //while ( is.read() != -1 );
-                    int i = is2.read();
-                    out.write(i);
-                    while (i != -1) {
-                        //System.out.write( i );
-                        i = is2.read();
-                        out.write(i);
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        });
-        serverErr.setDaemon(true);
-        serverErr.start();
-    }
-
+    @Override
     public void stop() {
         if (!serverHasAlreadyBeenStarted) {
             try {
                 System.out.println("[] STOP SERVER");
 
-                Socket socket = new Socket("localhost", 4200);
-                OutputStream out = socket.getOutputStream();
+                final Socket socket = new Socket("localhost", 4200);
+                final OutputStream out = socket.getOutputStream();
 
                 out.write("Stop".getBytes());
 
@@ -191,6 +124,7 @@ public class RemoteTestServer implements
         }
     }
 
+    @Override
     public Properties getContextEnvironment() {
         return (Properties) properties.clone();
     }
@@ -201,9 +135,10 @@ public class RemoteTestServer implements
 
     private boolean connect(int tries) {
         //System.out.println("CONNECT "+ tries);
+        OutputStream out = null;
         try {
-            Socket socket = new Socket("localhost", 4200);
-            OutputStream out = socket.getOutputStream();
+            final Socket socket = new Socket("localhost", 4200);
+            out = socket.getOutputStream();
         } catch (Exception e) {
             //System.out.println(e.getMessage());
             if (tries < 2) {
@@ -216,6 +151,14 @@ public class RemoteTestServer implements
                 }
                 return connect(--tries);
             }
+        } finally {
+            if (null != out) {
+                try {
+                    out.close();
+                } catch (Throwable e) {
+                    //Ignore
+                }
+            }
         }
 
         return true;
@@ -225,12 +168,13 @@ public class RemoteTestServer implements
         private final InputStream is;
         private final OutputStream out;
 
-        private Pipe(InputStream is, OutputStream out) {
+        private Pipe(final InputStream is, final OutputStream out) {
             super();
             this.is = is;
             this.out = out;
         }
 
+        @Override
         public void run() {
             try {
                 int i = is.read();

Modified: 
openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TomcatRemoteTestServer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TomcatRemoteTestServer.java?rev=1324635&r1=1324634&r2=1324635&view=diff
==============================================================================
--- 
openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TomcatRemoteTestServer.java
 (original)
+++ 
openejb/trunk/openejb/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TomcatRemoteTestServer.java
 Wed Apr 11 08:38:46 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.openejb.test;
 
+import java.io.InputStream;
 import java.net.URL;
 import java.util.Properties;
 
@@ -29,7 +30,8 @@ public class TomcatRemoteTestServer impl
 //
 //    private boolean serverHasAlreadyBeenStarted = true;
 
-    public void init(Properties props) {
+    @Override
+    public void init(final Properties props) {
         properties = props;
         serverUri = System.getProperty("openejb.server.uri", 
"http://127.0.0.1:8080/tomee/ejb";);
         if (!serverUri.startsWith("http:")) {
@@ -51,6 +53,7 @@ public class TomcatRemoteTestServer impl
 //        }
     }
 
+    @Override
     public void start() {
         if (connect()) {
             return;
@@ -71,15 +74,13 @@ public class TomcatRemoteTestServer impl
 //            e.printStackTrace();
 //            throw new RuntimeException("Cannot start the server: " + 
e.getClass().getName() + ": " + e.getMessage(), e);
 //        }
-        connect(10);
-        // Wait a wee bit longer for good measure
-        try {
-            Thread.sleep(5000);
-        } catch (Exception e) {
-            e.printStackTrace();
+
+        if (!connect(20)) {
+            throw new RuntimeException("Failed to connect");
         }
     }
 
+    @Override
     public void stop() {
 //        if (!serverHasAlreadyBeenStarted) {
 //            try {
@@ -115,6 +116,7 @@ public class TomcatRemoteTestServer impl
 //        serverErr.start();
 //    }
 
+    @Override
     public Properties getContextEnvironment() {
         return (Properties) properties.clone();
     }
@@ -142,9 +144,10 @@ public class TomcatRemoteTestServer impl
 
     private boolean connect(int tries) {
         //System.out.println("CONNECT "+ tries);
+        InputStream is = null;
         try {
-            URL url = new URL(serverUri);
-            url.openStream();
+            final URL url = new URL(serverUri);
+            is = url.openStream();
         } catch (Exception e) {
             tries--;
             //System.out.println(e.getMessage());
@@ -152,12 +155,20 @@ public class TomcatRemoteTestServer impl
                 return false;
             } else {
                 try {
-                    Thread.sleep(5000);
+                    Thread.sleep(2000);
                 } catch (Exception e2) {
                     e.printStackTrace();
                 }
                 return connect(tries);
             }
+        } finally {
+            if (null != is) {
+                try {
+                    is.close();
+                } catch (Throwable e) {
+                    //Ignore
+                }
+            }
         }
 
         return true;

Modified: 
openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/Response.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/Response.java?rev=1324635&r1=1324634&r2=1324635&view=diff
==============================================================================
--- 
openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/Response.java
 (original)
+++ 
openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/Response.java
 Wed Apr 11 08:38:46 2012
@@ -23,8 +23,10 @@ import java.io.ObjectOutput;
 
 public interface Response extends Externalizable {
 
+    @Override
     public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException;
 
+    @Override
     public void writeExternal(ObjectOutput out) throws IOException;
 
 }

Modified: 
openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/Start.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/Start.java?rev=1324635&r1=1324634&r2=1324635&view=diff
==============================================================================
--- 
openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/Start.java
 (original)
+++ 
openejb/trunk/openejb/server/openejb-server/src/main/java/org/apache/openejb/server/Start.java
 Wed Apr 11 08:38:46 2012
@@ -19,19 +19,11 @@ package org.apache.openejb.server;
 import org.apache.openejb.util.Connect;
 
 import java.io.File;
-
 import java.io.InputStream;
-
 import java.io.OutputStream;
-
 import java.lang.reflect.Method;
-
 import java.util.ArrayList;
-
-import java.util.Iterator;
-
 import java.util.Map;
-
 import java.util.Set;
 
 public class Start {
@@ -66,11 +58,14 @@ public class Start {
 
         try {
 
-            ArrayList cmd = new ArrayList();
+            ArrayList<String> cmd = new ArrayList<String>();
 
             String s = java.io.File.separator;
 
-            String java = System.getProperty("java.home") + s + "bin" + s + 
"java";
+            //Not really required here for exec, but as a reminder that we run 
on all platforms
+            final boolean isWindows = 
System.getProperty("os.name").toLowerCase().contains("win");
+
+            String java = System.getProperty("java.home") + s + "bin" + s + 
(isWindows ? "java.exe" : "java");
 
             cmd.add(java);
 
@@ -82,7 +77,7 @@ public class Start {
 
             cmd.add("org.apache.openejb.server.Main");
 
-            String[] command = (String[]) cmd.toArray(new String[0]);
+            String[] command = cmd.toArray(new String[cmd.size()]);
 
             Runtime runtime = Runtime.getRuntime();
 
@@ -112,13 +107,13 @@ public class Start {
 
     }
 
-    private void addSystemProperties(ArrayList cmd) {
+    private void addSystemProperties(ArrayList<String> cmd) {
 
         Set set = System.getProperties().entrySet();
 
-        for (Iterator iter = set.iterator(); iter.hasNext();) {
+        for (final Object aSet : set) {
 
-            Map.Entry entry = (Map.Entry) iter.next();
+            Map.Entry entry = (Map.Entry) aSet;
 
             String key = (String) entry.getKey();
 
@@ -190,6 +185,7 @@ public class Start {
 
         }
 
+        @Override
         public void run() {
 
             try {


Reply via email to