Browse Source

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
master
Antoine Levy-Lambert 22 years ago
parent
commit
b91587431f
3 changed files with 9 additions and 5 deletions
  1. +5
    -1
      WHATSNEW
  2. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  3. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java

+ 5
- 1
WHATSNEW View File

@@ -119,7 +119,11 @@ Fixed bugs:
Bugzilla Report 19187.

* file names that include spaces need to be quoted inside the @argfile
argument using forked <javac> and JDK 1.4. Bugzilla Report 10499.
argument using forked <javac> 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 <zip> and related tasks would cause the
archives to be always recreated. Bugzilla Report 19449.


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -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]);


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java View File

@@ -80,8 +80,7 @@ public class JavacExternal extends DefaultCompilerAdapter {

return
executeExternalCompile(cmd.getCommandline(), firstFileName,
!assumeJava11() && !assumeJava12()
&& !assumeJava13())
true)
== 0;
}



Loading…
Cancel
Save