From f7159e8a084a3fcb76b933d393df1fc855d74d78 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 28 Jul 2020 21:51:01 +0200 Subject: [PATCH] document why we are actually removing the file before writing --- .../org/apache/tools/ant/types/resources/FileResource.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/types/resources/FileResource.java b/src/main/org/apache/tools/ant/types/resources/FileResource.java index d8d604c0f..17ed7cc46 100644 --- a/src/main/org/apache/tools/ant/types/resources/FileResource.java +++ b/src/main/org/apache/tools/ant/types/resources/FileResource.java @@ -255,7 +255,8 @@ public class FileResource extends Resource implements Touchable, FileProvider, private OutputStream getOutputStream(boolean append) throws IOException { File f = getNotNullFile(); if (f.exists()) { - if (f.isFile() && !append) { + if (Files.isSymbolicLink(f.toPath()) && f.isFile() && !append) { + // https://bz.apache.org/bugzilla/show_bug.cgi?id=624 f.delete(); } } else {