diff --git a/WHATSNEW b/WHATSNEW
index d7eb1d42c..63c03b837 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -135,6 +135,12 @@ Changes that could break older environments:
behavior you will now need to explicitly specify the trailing *.
Bugzilla Report 46506.
+ * silently ignored missing resources even with
+ failOnError="true". If your build tries to copy non-existant
+ resources and you relied on this behavior you must now explicitly
+ set failOnError to false.
+ Bugzilla Report 47362.
+
Fixed bugs:
-----------
@@ -721,7 +727,7 @@ Other changes:
* CBZip2OutputStream now has a finish method separate from close.
Bugzilla Report 42713.
- * the and family of tasks has new option to deal with
+ * the and family of tasks has new options to deal with
file name and comment encoding. Please see the zip tasks'
documentation for details.
diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java
index d37b16af2..28add025f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Copy.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java
@@ -464,6 +464,13 @@ public class Copy extends Task {
while (resources.hasNext()) {
Resource r = (Resource) resources.next();
if (!r.isExists()) {
+ String message = "Warning: Could not find resource "
+ + r.toLongString() + " to copy.";
+ if (!failonerror) {
+ log(message, Project.MSG_ERR);
+ } else {
+ throw new BuildException(message);
+ }
continue;
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/Sync.java b/src/main/org/apache/tools/ant/taskdefs/Sync.java
index 7111dd622..8f7ade95f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Sync.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Sync.java
@@ -36,6 +36,8 @@ import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.Restrict;
+import org.apache.tools.ant.types.resources.selectors.Exists;
import org.apache.tools.ant.types.selectors.FileSelector;
import org.apache.tools.ant.types.selectors.NoneSelector;
@@ -62,6 +64,8 @@ public class Sync extends Task {
// Similar to a fileset, but doesn't allow dir attribute to be set
private SyncTarget syncTarget;
+ private Restrict resources = null;
+
// Override Task#init
/**
* Initialize the sync task.
@@ -390,7 +394,17 @@ public class Sync extends Task {
* @since Ant 1.7
*/
public void add(ResourceCollection rc) {
- myCopy.add(rc);
+ if (rc instanceof FileSet && rc.isFilesystemOnly()) {
+ // receives special treatment in copy that this task relies on
+ myCopy.add(rc);
+ } else {
+ if (resources == null) {
+ resources = new Restrict();
+ resources.add(new Exists());
+ myCopy.add(resources);
+ }
+ resources.add(rc);
+ }
}
/**
diff --git a/src/tests/antunit/taskdefs/copy-test.xml b/src/tests/antunit/taskdefs/copy-test.xml
index 74486a110..5e1458687 100644
--- a/src/tests/antunit/taskdefs/copy-test.xml
+++ b/src/tests/antunit/taskdefs/copy-test.xml
@@ -138,4 +138,16 @@ public class NullByteStreamResource extends Resource {
+
+
+
+
+
+
+
+
+
+
+