From f7159e8a084a3fcb76b933d393df1fc855d74d78 Mon Sep 17 00:00:00 2001
From: Stefan Bodewig <bodewig@apache.org>
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 d8d604c0f8..17ed7cc463 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 OutputStream getAppendOutputStream() throws IOException {
     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 {
