From c141e2c273180b94186dcb1c98eddf274077ba04 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Mon, 9 Jan 2006 15:11:36 +0000 Subject: [PATCH] support failonerror when file locked or similar issue. Bugzilla report 38175. Submitted by Georges-Etienne Legendre. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@367316 13f79535-47bb-0310-9956-ffa450edef68 --- CONTRIBUTORS | 1 + WHATSNEW | 3 +++ src/main/org/apache/tools/ant/taskdefs/Copy.java | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2a86da185..bff5714ea 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -72,6 +72,7 @@ Frank Harnack Frederic Lavigne Gary S. Weaver Gautam Guliani +Georges-Etienne Legendre Gero Vermaas Gerrit Riessen Glenn McAllister diff --git a/WHATSNEW b/WHATSNEW index f02e95d93..914a89466 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -175,6 +175,9 @@ Fixed bugs: * Project not set on ChainReaderHelpers used by the Redirector. Bugzilla report 37958. +* Copy task would fail on locked (or otherwise uncopyable) files even if + failonerror set to false. Bugzilla report 38175. + Other changes: -------------- * Minor performance improvements Bugzilla report 37777 diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java index e35cd19b1..4bc0bc4dc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copy.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java @@ -799,7 +799,10 @@ public class Copy extends Task { if (targetFile.exists() && !targetFile.delete()) { msg += " and I couldn't delete the corrupt " + toFile; } - throw new BuildException(msg, ioe, getLocation()); + if (failonerror) { + throw new BuildException(msg, ioe, getLocation()); + } + log(msg, Project.MSG_ERR); } } }