| If you try to launch a blank command (' ') using Launch.ProcStarter#cmdAsSingleString, an ArrayIndexOutOfBoundException is thrown. Example of command invocation:
launcher.launch()
.cmdAsSingleString(" ")
.envs(computer.getEnvironment())
.readStdout()
.pwd(rootPath)
.start();
Exception thrown:
java.lang.ArrayIndexOutOfBoundsException: 0
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1014)
at hudson.Proc$LocalProc.<init>(Proc.java:249)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:930)
at hudson.Launcher$ProcStarter.start(Launcher.java:450)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1299)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1260)
at hudson.remoting.UserRequest.perform(UserRequest.java:205)
at hudson.remoting.UserRequest.perform(UserRequest.java:52)
at hudson.remoting.Request$2.run(Request.java:356)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
This exception is odd, and difficult to understand. In my understanding, the cause of the error (invalid command) should be more clear, and ideally, validated sooner. |