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 2019/07/01 19:41:38 UTC

[commons-io] branch master updated: Remove throws IOException in method isSymlink() (#80)

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 d9e154a  Remove throws IOException in method isSymlink() (#80)
d9e154a is described below

commit d9e154a5d7fb86c686ecbe0b1f2e1d72e65f0993
Author: Sebastian <ry...@web.de>
AuthorDate: Mon Jul 1 21:41:33 2019 +0200

    Remove throws IOException in method isSymlink() (#80)
    
    * Remove throws IOException in method isSymlink()
    
    The IOException is caught in 'Files.isSymbolicLink(Path path)' and therefore not thrown anymore in 'public static boolean isSymlink(final File file)'.
    
    * Update FileUtils.java
    
    Remove some not thrown IOExceptions
    
    * Update FileUtils.java
    
    Remove some not thrown IOExceptions
---
 src/main/java/org/apache/commons/io/FileUtils.java | 23 +++++++---------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java
index 874eff9..efc1a64 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -2683,15 +2683,11 @@ public class FileUtils {
         long size = 0;
 
         for (final File file : files) {
-            try {
-                if (!isSymlink(file)) {
-                    size += sizeOf0(file); // internal method
-                    if (size < 0) {
-                        break;
-                    }
+            if (!isSymlink(file)) {
+                size += sizeOf0(file); // internal method
+                if (size < 0) {
+                    break;
                 }
-            } catch (final IOException ioe) {
-                // Ignore exceptions caught when asking if a File is a symlink.
             }
         }
 
@@ -2741,12 +2737,8 @@ public class FileUtils {
         BigInteger size = BigInteger.ZERO;
 
         for (final File file : files) {
-            try {
-                if (!isSymlink(file)) {
-                    size = size.add(sizeOfBig0(file));
-                }
-            } catch (final IOException ioe) {
-                // Ignore exceptions caught when asking if a File is a symlink.
+            if (!isSymlink(file)) {
+                size = size.add(sizeOfBig0(file));
             }
         }
 
@@ -3161,10 +3153,9 @@ public class FileUtils {
      * {@code boolean java.nio.file.Files.isSymbolicLink(Path path)}
      * @param file the file to check
      * @return true if the file is a Symbolic Link
-     * @throws IOException if an IO error occurs while checking the file
      * @since 2.0
      */
-    public static boolean isSymlink(final File file) throws IOException {
+    public static boolean isSymlink(final File file) {
         if (file == null) {
             throw new NullPointerException("File must not be null");
         }