425736 - jetty-start / Jetty 9 fails to startup with --exec option if Java path contain

+ Using .addRawArg() to avoid space escaping for Java Bin
This commit is contained in:
Joakim Erdfelt 2014-03-27 12:36:34 -07:00
parent 76d365677a
commit f3d312698f
3 changed files with 20 additions and 4 deletions

View File

@ -192,4 +192,19 @@ public class CommandLineBuilder
return buf.toString(); return buf.toString();
} }
public void debug()
{
if (!StartLog.isDebugEnabled())
{
return;
}
int len = args.size();
StartLog.debug("Command Line: %,d entries",args.size());
for (int i = 0; i < len; i++)
{
StartLog.debug(" [%d]: \"%s\"",i,args.get(i));
}
}
} }

View File

@ -687,6 +687,7 @@ public class Main
if (args.isExec()) if (args.isExec())
{ {
CommandLineBuilder cmd = args.getMainArgs(baseHome,true); CommandLineBuilder cmd = args.getMainArgs(baseHome,true);
cmd.debug();
ProcessBuilder pbuilder = new ProcessBuilder(cmd.getArgs()); ProcessBuilder pbuilder = new ProcessBuilder(cmd.getArgs());
final Process process = pbuilder.start(); final Process process = pbuilder.start();
Runtime.getRuntime().addShutdownHook(new Thread() Runtime.getRuntime().addShutdownHook(new Thread()

View File

@ -408,11 +408,11 @@ public class StartArgs
if (addJavaInit) if (addJavaInit)
{ {
cmd.addArg(CommandLineBuilder.findJavaBin()); cmd.addRawArg(CommandLineBuilder.findJavaBin());
for (String x : jvmArgs) for (String x : jvmArgs)
{ {
cmd.addArg(x); cmd.addRawArg(x);
} }
cmd.addRawArg("-Djetty.home=" + baseHome.getHome()); cmd.addRawArg("-Djetty.home=" + baseHome.getHome());
@ -425,7 +425,7 @@ public class StartArgs
cmd.addEqualsArg("-D" + propKey,value); cmd.addEqualsArg("-D" + propKey,value);
} }
cmd.addArg("-cp"); cmd.addRawArg("-cp");
cmd.addRawArg(classpath.toString()); cmd.addRawArg(classpath.toString());
cmd.addRawArg(getMainClassname()); cmd.addRawArg(getMainClassname());
} }
@ -447,7 +447,7 @@ public class StartArgs
{ {
properties.store(out,"start.jar properties"); properties.store(out,"start.jar properties");
} }
cmd.addArg(prop_file.getAbsolutePath()); cmd.addRawArg(prop_file.getAbsolutePath());
} }
for (File xml : xmls) for (File xml : xmls)