You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/01/26 14:54:30 UTC

[commons-io] branch master updated: No need to check if the directory already exists.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new a66a125  No need to check if the directory already exists.
a66a125 is described below

commit a66a1253fb64b429608ddba8461d185920f360c5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jan 26 09:54:21 2021 -0500

    No need to check if the directory already exists.
    
    Files.createDirectories() Javadoc states that an exception is not thrown
    if the directory could not be created because it already exists.
---
 src/main/java/org/apache/commons/io/file/PathUtils.java | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/file/PathUtils.java b/src/main/java/org/apache/commons/io/file/PathUtils.java
index 978ba5a..ac8eac3 100644
--- a/src/main/java/org/apache/commons/io/file/PathUtils.java
+++ b/src/main/java/org/apache/commons/io/file/PathUtils.java
@@ -308,9 +308,6 @@ public final class PathUtils {
         if (parent == null) {
             return null;
         }
-        if (Files.isDirectory(parent)) {
-            return parent;
-        }
         return Files.createDirectories(parent, attrs);
     }