hibernate->JPA for authorization rules.
[utils] / support / general / src / main / java / org / wamblee / io / SimpleProcess.java
index de93e547638d1db49d6c47e57be33665e83d37af..f0090f53215c0d6af3a80228329eddaed930b97e 100644 (file)
@@ -27,6 +27,7 @@ import java.io.OutputStream;
 import java.io.PrintStream;
 import java.io.StringWriter;
 import java.io.Writer;
+import java.util.Arrays;
 
 /**
  * 
@@ -50,7 +51,7 @@ public class SimpleProcess {
      */
     public SimpleProcess(File aDirectory, String[] aCmd) {
         directory = aDirectory;
-        cmd = aCmd;
+        cmd = Arrays.copyOf(aCmd, aCmd.length);
     }
 
     /**
@@ -83,10 +84,10 @@ public class SimpleProcess {
 
     private int runImpl() throws IOException {
         try {
-            String fullcmd = "";
+            StringBuffer fullcmd = new StringBuffer();
 
             for (String part : cmd) {
-                fullcmd += (" " + part);
+                fullcmd.append(" " + part);
             }
 
             LOG.debug("Executing '" + fullcmd + "' in directory '" + directory +
@@ -182,10 +183,10 @@ public class SimpleProcess {
 
     @Override
     public String toString() {
-        String fullcmd = "";
+        StringBuffer fullcmd = new StringBuffer();
 
         for (String part : cmd) {
-            fullcmd += (part + " ");
+            fullcmd.append(part + " ");
         }
 
         return "process(dir = '" + directory + "', cmd = '" + fullcmd + "')";