@@ -10,6 +10,11 @@ Changes that could break older environments: | |||||
* The <apt> task has been removed since apt itself has been removed | * The <apt> task has been removed since apt itself has been removed | ||||
with Java8. | with Java8. | ||||
* <fileset>/<zipfileset>/<tarfileset> exhibited undefined | |||||
behavior when both the dir and file attribute have been used on the | |||||
same instance. This will now cause the build to fail. | |||||
Bugzilla Report 59402 | |||||
Fixed bugs: | Fixed bugs: | ||||
----------- | ----------- | ||||
@@ -50,7 +50,7 @@ equivalent to an <code><and></code> selector container.</p> | |||||
<tr> | <tr> | ||||
<td valign="top">dir</td> | <td valign="top">dir</td> | ||||
<td valign="top">the root of the directory tree of this FileSet.</td> | <td valign="top">the root of the directory tree of this FileSet.</td> | ||||
<td valign="middle" align="center" rowspan="2">Either dir or file must be specified</td> | |||||
<td valign="middle" align="center" rowspan="2">Exactly one of dir or file must be specified</td> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">file</td> | <td valign="top">file</td> | ||||
@@ -382,7 +382,6 @@ public abstract class AbstractJarSignerTask extends Task { | |||||
FileSet sourceJar = new FileSet(); | FileSet sourceJar = new FileSet(); | ||||
sourceJar.setProject(getProject()); | sourceJar.setProject(getProject()); | ||||
sourceJar.setFile(jar); | sourceJar.setFile(jar); | ||||
sourceJar.setDir(jar.getParentFile()); | |||||
sources.add(sourceJar); | sources.add(sourceJar); | ||||
} | } | ||||
return sources; | return sources; | ||||
@@ -70,6 +70,7 @@ public abstract class AbstractFileSet extends DataType | |||||
private List<FileSelector> selectors = new ArrayList<FileSelector>(); | private List<FileSelector> selectors = new ArrayList<FileSelector>(); | ||||
private File dir; | private File dir; | ||||
private boolean fileAttributeUsed; | |||||
private boolean useDefaultExcludes = true; | private boolean useDefaultExcludes = true; | ||||
private boolean caseSensitive = true; | private boolean caseSensitive = true; | ||||
private boolean followSymlinks = true; | private boolean followSymlinks = true; | ||||
@@ -134,6 +135,9 @@ public abstract class AbstractFileSet extends DataType | |||||
if (isReference()) { | if (isReference()) { | ||||
throw tooManyAttributes(); | throw tooManyAttributes(); | ||||
} | } | ||||
if (fileAttributeUsed && !getDir().equals(dir)) { | |||||
throw dirAndFileAreMutuallyExclusive(); | |||||
} | |||||
this.dir = dir; | this.dir = dir; | ||||
directoryScanner = null; | directoryScanner = null; | ||||
} | } | ||||
@@ -231,7 +235,11 @@ public abstract class AbstractFileSet extends DataType | |||||
if (isReference()) { | if (isReference()) { | ||||
throw tooManyAttributes(); | throw tooManyAttributes(); | ||||
} | } | ||||
if (getDir() != null) { | |||||
throw dirAndFileAreMutuallyExclusive(); | |||||
} | |||||
setDir(file.getParentFile()); | setDir(file.getParentFile()); | ||||
fileAttributeUsed = true; | |||||
createInclude().setName(file.getName()); | createInclude().setName(file.getName()); | ||||
} | } | ||||
@@ -943,4 +951,8 @@ public abstract class AbstractFileSet extends DataType | |||||
setChecked(true); | setChecked(true); | ||||
} | } | ||||
} | } | ||||
private BuildException dirAndFileAreMutuallyExclusive() { | |||||
return new BuildException("you can only specify one of the dir and file attributes"); | |||||
} | |||||
} | } |
@@ -64,4 +64,22 @@ | |||||
<au:assertLogContains text="fileset-test.xml"/> | <au:assertLogContains text="fileset-test.xml"/> | ||||
</target> | </target> | ||||
<target name="test-fileset-dir-and-file-exception"> | |||||
<mkdir dir="${output}"/> | |||||
<au:expectfailure expectedmessage="you can only specify one of the dir and file attributes"> | |||||
<copy todir="${output}"> | |||||
<fileset dir="foo" file="bar" /> | |||||
</copy> | |||||
</au:expectfailure> | |||||
</target> | |||||
<target name="test-fileset-file-and-dir-exception"> | |||||
<mkdir dir="${output}"/> | |||||
<au:expectfailure expectedmessage="you can only specify one of the dir and file attributes"> | |||||
<copy todir="${output}"> | |||||
<fileset file="bar" dir="foo"/> | |||||
</copy> | |||||
</au:expectfailure> | |||||
</target> | |||||
</project> | </project> |