# HG changeset patch # User uta # Date 1362736022 -14400 # Node ID 46326d5499d7a6193f1a02a822cc035096ed2064 # Parent 56477df97a760724b151e90c1a3a7cff857d2bab 8009463: Regression test test\java\lang\Runtime\exec\ArgWithSpaceAndFinalBackslash.java failing. Reviewed-by: alanb, ahgross diff -r 56477df97a76 -r 46326d5499d7 src/windows/classes/java/lang/ProcessImpl.java --- a/src/windows/classes/java/lang/ProcessImpl.java Mon Apr 29 10:20:55 2013 -0400 +++ b/src/windows/classes/java/lang/ProcessImpl.java Fri Mar 08 13:47:02 2013 +0400 @@ -262,6 +262,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);