# HG changeset patch # User uta # Date 1362735315 -14400 # Node ID d54b22d3b306b96f11e73fda7ba12793ac53ff8c # Parent e745e337f767af8eeb5e02cb7da98396419d8065 8009463: Regression test test\java\lang\Runtime\exec\ArgWithSpaceAndFinalBackslash.java failing. Reviewed-by: alanb, ahgross diff -r e745e337f767 -r d54b22d3b306 jdk/src/windows/classes/java/lang/ProcessImpl.java --- a/jdk/src/windows/classes/java/lang/ProcessImpl.java Thu Mar 14 18:41:42 2013 +0100 +++ b/jdk/src/windows/classes/java/lang/ProcessImpl.java Fri Mar 08 13:35:15 2013 +0400 @@ -263,6 +263,22 @@ if (needsEscaping(isCmdFile, s)) { cmdbuf.append('"'); cmdbuf.append(s); + + // The code protects the [java.exe] and console command line + // parser, that interprets the [\"] combination as an escape + // sequence for the ["] char. + // http://msdn.microsoft.com/en-us/library/17w5ykft.aspx + // + // If the argument is an FS path, doubling of the tail [\] + // char is not a problem for non-console applications. + // + // The [\"] sequence is not an escape sequence for the [cmd.exe] + // command line parser. The case of the [""] tail escape + // sequence could not be realized due to the argument validation + // procedure. + if (!isCmdFile && s.endsWith("\\")) { + cmdbuf.append('\\'); + } cmdbuf.append('"'); } else { cmdbuf.append(s);