From b2897fdd66b5ea0e3597a1f56bf8af69f9d024ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 10:57:45 +0900 Subject: [PATCH] HADOOP-17683. Update commons-io to 2.8.0 (#2974) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Akira Ajisaka Signed-off-by: Wei-Chiu Chuang (cherry picked from commit 29105ffb634ceb44a331ba65280d418544b902a6) --- LICENSE-binary | 2 +- .../java/org/apache/hadoop/fs/FileUtil.java | 18 ++++++------------ hadoop-project/pom.xml | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/LICENSE-binary b/LICENSE-binary index 4fa65d5d0e..c3653f9b04 100644 --- a/LICENSE-binary +++ b/LICENSE-binary @@ -249,7 +249,7 @@ commons-cli:commons-cli:1.2 commons-codec:commons-codec:1.11 commons-collections:commons-collections:3.2.2 commons-daemon:commons-daemon:1.0.13 -commons-io:commons-io:2.5 +commons-io:commons-io:2.8.0 commons-lang:commons-lang:2.6 commons-logging:commons-logging:1.1.3 commons-net:commons-net:3.6 diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java index 73ca6e6521..444f992704 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java @@ -604,18 +604,12 @@ public static long getDU(File dir) { return dir.length(); } else { File[] allFiles = dir.listFiles(); - if(allFiles != null) { - for (int i = 0; i < allFiles.length; i++) { - boolean isSymLink; - try { - isSymLink = org.apache.commons.io.FileUtils.isSymlink(allFiles[i]); - } catch(IOException ioe) { - isSymLink = true; - } - if(!isSymLink) { - size += getDU(allFiles[i]); - } - } + if (allFiles != null) { + for (File f : allFiles) { + if (!org.apache.commons.io.FileUtils.isSymlink(f)) { + size += getDU(f); + } + } } return size; } diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index de9864eb15..ad5c9740d4 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -120,7 +120,7 @@ 3.2.2 1.19 1.0 - 2.5 + 2.8.0 3.7 1.1.3 1.1