diff --git a/WHATSNEW b/WHATSNEW index d0f41b60d..81842d77c 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -119,7 +119,11 @@ Fixed bugs: Bugzilla Report 19187. * file names that include spaces need to be quoted inside the @argfile - argument using forked and JDK 1.4. Bugzilla Report 10499. + argument using forked and (all JDKS). Bugzilla Report 10499. + NB : a first correction was only introducing quotes for JDK 1.4 + It has been changed to quote for all external compilers when paths contain spaces. + Also the backslashes need to be converted to forward slashes + Bugzilla Report 17683. * Setting filesonly to true in and related tasks would cause the archives to be always recreated. Bugzilla Report 19449. diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index b4c2442a3..11032fed8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -405,7 +405,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { * system. */ protected int executeExternalCompile(String[] args, int firstFileName) { - return executeExternalCompile(args, firstFileName, false); + return executeExternalCompile(args, firstFileName, true); } /** @@ -415,7 +415,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { * if the index is negative, no temporary file will ever be * created, but this may hit the command line length limit on your * system. - * @param quoteFilenames - if set to true, filenames containing + * @param quoteFiles - if set to true, filenames containing * spaces will be quoted when they appear in the external file. * This is necessary when running JDK 1.4's javac and probably * others. @@ -448,6 +448,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { out = new PrintWriter(new FileWriter(tmpFile)); for (int i = firstFileName; i < args.length; i++) { if (quoteFiles && args[i].indexOf(" ") > -1) { + args[i] = args[i].replace('\\', '/'); out.println("\"" + args[i] + "\""); } else { out.println(args[i]); diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java b/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java index 7e0cf39d1..2aa27e8ef 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java @@ -80,8 +80,7 @@ public class JavacExternal extends DefaultCompilerAdapter { return executeExternalCompile(cmd.getCommandline(), firstFileName, - !assumeJava11() && !assumeJava12() - && !assumeJava13()) + true) == 0; }