From b91587431f111bc616846344d88086667b3b2a16 Mon Sep 17 00:00:00 2001 From: Antoine Levy-Lambert Date: Tue, 3 Jun 2003 21:13:54 +0000 Subject: [PATCH] Make sure that javac source files in lists passed to external compilers are always quoted in the default external compiler implementations Also replace backslashes with slashes in path names containing spaces PR: 10499 17683 Submitted by: Joe Boon (joe dot boon at cdcsolutions dot com) and Anne Kinsella (anne dot kinsella at iona dot com) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274642 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 6 +++++- .../ant/taskdefs/compilers/DefaultCompilerAdapter.java | 5 +++-- .../apache/tools/ant/taskdefs/compilers/JavacExternal.java | 3 +-- 3 files changed, 9 insertions(+), 5 deletions(-) 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; }