diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java b/src/main/org/apache/tools/ant/taskdefs/Delete.java index 76cafafd7..e1895041b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Delete.java +++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java @@ -661,15 +661,15 @@ public class Delete extends MatchingTask { */ private boolean delete(File f) { if (!FILE_UTILS.tryHardToDelete(f)) { - if (deleteOnExit) { - int level = quiet ? Project.MSG_VERBOSE : Project.MSG_INFO; - log("Failed to delete " + f + ", calling deleteOnExit." - + " This attempts to delete the file when the Ant jvm" - + " has exited and might not succeed.", level); - f.deleteOnExit(); - return true; - } - return false; + if (deleteOnExit) { + int level = quiet ? Project.MSG_VERBOSE : Project.MSG_INFO; + log("Failed to delete " + f + ", calling deleteOnExit." + + " This attempts to delete the file when the Ant jvm" + + " has exited and might not succeed.", level); + f.deleteOnExit(); + return true; + } + return false; } return true; } diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java index b3477afe0..373129cd2 100644 --- a/src/main/org/apache/tools/ant/util/FileUtils.java +++ b/src/main/org/apache/tools/ant/util/FileUtils.java @@ -1230,7 +1230,8 @@ public class FileUtils { System.err.println("Rename of " + from + " to " + to + " is a no-op."); return; } - if (to.exists() && !(from.equals(to.getCanonicalFile()) || tryHardToDelete(to))) { + if (to.exists() && + !(from.equals(to.getCanonicalFile()) || tryHardToDelete(to))) { throw new IOException("Failed to delete " + to + " while trying to rename " + from); } File parent = to.getParentFile();