From 56b71657559799f369a61b5aa1864c88a8c6ec5e Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 26 Apr 2012 23:17:59 +0300 Subject: [PATCH] INT-2533-2.1.x: ForkUtil -cp arg fix --- .../integration/gemfire/fork/ForkUtil.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java index 24cd63553e..ea0f580b1c 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/fork/ForkUtil.java @@ -40,20 +40,19 @@ public class ForkUtil { String home = System.getProperty("java.home"); Process proc = null; - String java = home + "/bin/java ".replace("\\", "/"); - ; - String argCp = "-cp " + cp; + String java = home + "/bin/java".replace("\\", "/"); + String argClass = argument; - String cmd = java + argCp + " " + argClass; + String[] cmdArray = {java, "-cp", cp, argClass}; try { // ProcessBuilder builder = new ProcessBuilder(cmd, argCp, // argClass); // builder.redirectErrorStream(true); - proc = Runtime.getRuntime().exec(cmd); + proc = Runtime.getRuntime().exec(cmdArray); } catch (IOException ioe) { - throw new IllegalStateException("Cannot start command " + cmd, ioe); + throw new IllegalStateException("Cannot start command " + cmdArray, ioe); } System.out.println("Started fork"); @@ -151,4 +150,4 @@ public class ForkUtil { return new File(path).exists(); } -} \ No newline at end of file +}