38ef01
From 610065347bbbc8fea366de32e558de4977807e52 Mon Sep 17 00:00:00 2001
38ef01
From: Mat Booth <mat.booth@redhat.com>
38ef01
Date: Wed, 3 Feb 2021 19:45:13 +0000
38ef01
Subject: [PATCH] Fix Files.size failing when symlink target is non-existant
38ef01
38ef01
---
38ef01
 src/main/java/org/apache/commons/io/file/PathUtils.java | 2 +-
38ef01
 1 file changed, 1 insertion(+), 1 deletion(-)
38ef01
38ef01
diff --git a/src/main/java/org/apache/commons/io/file/PathUtils.java b/src/main/java/org/apache/commons/io/file/PathUtils.java
38ef01
index d370ef0b..b38a46a0 100644
38ef01
--- a/src/main/java/org/apache/commons/io/file/PathUtils.java
38ef01
+++ b/src/main/java/org/apache/commons/io/file/PathUtils.java
38ef01
@@ -358,7 +358,7 @@ public static PathCounters deleteFile(final Path file, final DeleteOption... opt
38ef01
         }
38ef01
         final PathCounters pathCounts = Counters.longPathCounters();
38ef01
         final boolean exists = Files.exists(file, LinkOption.NOFOLLOW_LINKS);
38ef01
-        final long size = exists ? Files.size(file) : 0;
38ef01
+        final long size = exists && Files.exists(file) ? Files.size(file) : 0;
38ef01
         if (overrideReadOnly(options) && exists) {
38ef01
             setReadOnly(file, false, LinkOption.NOFOLLOW_LINKS);
38ef01
         }
38ef01
-- 
38ef01
2.28.0
38ef01