@@ -427,6 +427,7 @@ Tim Stephenson | |||||
Tim Whittington | Tim Whittington | ||||
Timoteo Ohara | Timoteo Ohara | ||||
Timothy Gerard Endres | Timothy Gerard Endres | ||||
TJ Rothwell | |||||
Tom Ball | Tom Ball | ||||
Tom Brus | Tom Brus | ||||
Tom Cunningham | Tom Cunningham | ||||
@@ -7,6 +7,10 @@ Fixed bugs: | |||||
* SCP (with sftp=true) task would fail if fetching file located in root directory | * SCP (with sftp=true) task would fail if fetching file located in root directory | ||||
Bugzilla Report 64742 | Bugzilla Report 64742 | ||||
* javac task would fail if the arguments file it (internally) created didn't quote | |||||
the # character. This has now been fixed. | |||||
Bugzilla Reports 64912, 64790 | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -1760,6 +1760,10 @@ | |||||
<middle>Gerard</middle> | <middle>Gerard</middle> | ||||
<last>Endres</last> | <last>Endres</last> | ||||
</name> | </name> | ||||
<name> | |||||
<first>TJ</first> | |||||
<last>Rothwell</last> | |||||
</name> | |||||
<name> | <name> | ||||
<first>Tom</first> | <first>Tom</first> | ||||
<last>Ball</last> | <last>Ball</last> | ||||
@@ -23,6 +23,7 @@ import java.io.File; | |||||
import java.io.FileWriter; | import java.io.FileWriter; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.Optional; | import java.util.Optional; | ||||
import java.util.regex.Pattern; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
import java.util.stream.Stream; | import java.util.stream.Stream; | ||||
@@ -67,6 +68,8 @@ public abstract class DefaultCompilerAdapter | |||||
protected static final String lSep = StringUtils.LINE_SEP; | protected static final String lSep = StringUtils.LINE_SEP; | ||||
// CheckStyle:ConstantNameCheck ON | // CheckStyle:ConstantNameCheck ON | ||||
private static final Pattern JAVAC_ARG_FILE_CHARS_TO_QUOTE = Pattern.compile("[ #]"); // space or # character | |||||
protected Path src; | protected Path src; | ||||
protected File destDir; | protected File destDir; | ||||
protected String encoding; | protected String encoding; | ||||
@@ -549,7 +552,7 @@ public abstract class DefaultCompilerAdapter | |||||
try (BufferedWriter out = | try (BufferedWriter out = | ||||
new BufferedWriter(new FileWriter(tmpFile))) { | new BufferedWriter(new FileWriter(tmpFile))) { | ||||
for (int i = firstFileName; i < args.length; i++) { | for (int i = firstFileName; i < args.length; i++) { | ||||
if (quoteFiles && args[i].contains(" ")) { | |||||
if (quoteFiles && JAVAC_ARG_FILE_CHARS_TO_QUOTE.matcher(args[i]).find()) { | |||||
args[i] = | args[i] = | ||||
args[i].replace(File.separatorChar, '/'); | args[i].replace(File.separatorChar, '/'); | ||||
out.write("\"" + args[i] + "\""); | out.write("\"" + args[i] + "\""); | ||||
@@ -193,6 +193,26 @@ public class Adapter implements CompilerAdapter { | |||||
<au:assertLogContains text="adapter called" /> | <au:assertLogContains text="adapter called" /> | ||||
</target> | </target> | ||||
<target name="testSpaceCharInArgs" depends="setup" description="https://bz.apache.org/bugzilla/show_bug.cgi?id=64912"> | |||||
<delete dir="${javac-dir}/src" /> | |||||
<mkdir dir="${javac-dir}/src" /> | |||||
<echo file="${javac-dir}/src/Foo.java"> | |||||
public class Foo { } | |||||
</echo> | |||||
<mkdir dir="${output}/foo with space bar" /> | |||||
<javac srcdir="${javac-dir}/src" destdir="${output}/foo with space bar" fork="yes" failOnError="true"/> | |||||
</target> | |||||
<target name="test#CharInArgs" depends="setup" description="https://bz.apache.org/bugzilla/show_bug.cgi?id=64912"> | |||||
<delete dir="${javac-dir}/src" /> | |||||
<mkdir dir="${javac-dir}/src" /> | |||||
<echo file="${javac-dir}/src/Foo.java"> | |||||
public class Foo { } | |||||
</echo> | |||||
<mkdir dir="${output}/foo#bar" /> | |||||
<javac srcdir="${javac-dir}/src" destdir="${output}/foo#bar" fork="yes" failOnError="true"/> | |||||
</target> | |||||
<target name="testCompilerAsNestedElement" depends="-create-javac-adapter"> | <target name="testCompilerAsNestedElement" depends="-create-javac-adapter"> | ||||
<componentdef classname="org.example.Adapter" name="myjavac"> | <componentdef classname="org.example.Adapter" name="myjavac"> | ||||
<classpath location="${resources}" /> | <classpath location="${resources}" /> | ||||