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 bc73e5bd Remove obsolete comments and code
bc73e5bd is described below

commit bc73e5bde0a1ab0c08040b7e1a32cce753f5ae46
Author: Gary Gregory <gardgreg...@gmail.com>
AuthorDate: Tue Jun 14 18:50:52 2022 -0400

    Remove obsolete comments and code
---
 .../java/org/apache/commons/io/file/PathUtils.java | 38 +---------------------
 1 file changed, 1 insertion(+), 37 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 3889b3c8..d5041bce 100644
--- a/src/main/java/org/apache/commons/io/file/PathUtils.java
+++ b/src/main/java/org/apache/commons/io/file/PathUtils.java
@@ -1093,10 +1093,7 @@ public final class PathUtils {
     }
 
     static OutputStream newOutputStream(final Path path, final LinkOption[] 
linkOptions, final OpenOption... openOptions) throws IOException {
-        if (exists(path, linkOptions)) {
-            // requireFile(path, "path");
-            // requireCanWrite(path, "path");
-        } else {
+        if (!exists(path, linkOptions)) {
             createParentDirectories(path, linkOptions != null && 
linkOptions.length > 0 ? linkOptions[0] : NULL_LINK_OPTION);
         }
         final List<OpenOption> list = new 
ArrayList<>(Arrays.asList(openOptions != null ? openOptions : 
EMPTY_OPEN_OPTION_ARRAY));
@@ -1266,22 +1263,6 @@ public final class PathUtils {
         return stream.collect(Collectors.toList());
     }
 
-    /**
-     * Throws an {@link IllegalArgumentException} if the file is not writable. 
This provides a more precise exception
-     * message than a plain access denied.
-     *
-     * @param file The file to test.
-     * @param name The parameter name to use in the exception message.
-     * @throws NullPointerException if the given {@code Path} is {@code null}.
-     * @throws IllegalArgumentException if the file is not writable.
-     */
-    private static void requireCanWrite(final Path file, final String name) {
-        Objects.requireNonNull(file, "file");
-        if (!Files.isWritable(file)) {
-            throw new IllegalArgumentException("File parameter '" + name + " 
is not writable: '" + file + "'");
-        }
-    }
-
     /**
      * Requires that the given {@code File} exists and throws an {@link 
IllegalArgumentException} if it doesn't.
      *
@@ -1300,23 +1281,6 @@ public final class PathUtils {
         return file;
     }
 
-    /**
-     * Requires that the given {@code Path} is a regular file.
-     *
-     * @param file The {@code Path} to check.
-     * @param name The parameter name to use in the exception message.
-     * @return the given file.
-     * @throws NullPointerException if the given {@code Path} is {@code null}.
-     * @throws IllegalArgumentException if the given {@code Path} does not 
exist or is not a regular file.
-     */
-    private static Path requireFile(final Path file, final String name) {
-        Objects.requireNonNull(file, name);
-        if (!Files.isRegularFile(file)) {
-            throw new IllegalArgumentException("Parameter '" + name + "' is 
not a regular file: " + file);
-        }
-        return file;
-    }
-
     private static boolean setDosReadOnly(final Path path, final boolean 
readOnly, final LinkOption... linkOptions) throws IOException {
         final DosFileAttributeView dosFileAttributeView = 
getDosFileAttributeView(path, linkOptions);
         if (dosFileAttributeView != null) {

Reply via email to