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/08 15:36:59 UTC

[commons-vfs] branch master updated: Collapse multiple identical catch clauses into one.

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-vfs.git


The following commit(s) were added to refs/heads/master by this push:
     new a5547ee  Collapse multiple identical catch clauses into one.
a5547ee is described below

commit a5547eec19088d56283908071966dbb1999c6fc4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jan 8 10:36:54 2021 -0500

    Collapse multiple identical catch clauses into one.
---
 .../commons/vfs2/provider/AbstractFileObject.java       |  4 +---
 .../commons/vfs2/provider/AbstractFileSystem.java       |  8 +-------
 .../vfs2/util/DelegatingFileSystemOptionsBuilder.java   | 17 ++++-------------
 3 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
index adc6064..a1b0d83 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
@@ -1197,9 +1197,7 @@ public abstract class AbstractFileObject<AFS extends AbstractFileSystem> impleme
         // Get the raw input stream
         try {
             return doGetInputStream(bufferSize);
-        } catch (final org.apache.commons.vfs2.FileNotFoundException exc) {
-            throw new org.apache.commons.vfs2.FileNotFoundException(fileName, exc);
-        } catch (final FileNotFoundException exc) {
+        } catch (final org.apache.commons.vfs2.FileNotFoundException | FileNotFoundException exc) {
             throw new org.apache.commons.vfs2.FileNotFoundException(fileName, exc);
         } catch (final FileSystemException exc) {
             throw exc;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
index 0486d26..71d777d 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
@@ -350,13 +350,7 @@ public abstract class AbstractFileSystem extends AbstractVfsComponent implements
         if (getFileSystemManager().getFileObjectDecoratorConst() != null) {
             try {
                 file = (FileObject) getFileSystemManager().getFileObjectDecoratorConst().newInstance(file);
-            } catch (final InstantiationException e) {
-                throw new FileSystemException("vfs.impl/invalid-decorator.error",
-                        getFileSystemManager().getFileObjectDecorator().getName(), e);
-            } catch (final IllegalAccessException e) {
-                throw new FileSystemException("vfs.impl/invalid-decorator.error",
-                        getFileSystemManager().getFileObjectDecorator().getName(), e);
-            } catch (final InvocationTargetException e) {
+            } catch (final InstantiationException | IllegalAccessException | InvocationTargetException e) {
                 throw new FileSystemException("vfs.impl/invalid-decorator.error",
                         getFileSystemManager().getFileObjectDecorator().getName(), e);
             }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilder.java
index 19ae6a8..7e928e7 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilder.java
@@ -259,13 +259,8 @@ public class DelegatingFileSystemOptionsBuilder {
             // can convert using constructor
             for (int iterValues = 0; iterValues < ctx.values.length; iterValues++) {
                 try {
-                    Array.set(convertedValues, iterValues,
-                            valueConstructor.newInstance(ctx.values[iterValues]));
-                } catch (final InstantiationException e) {
-                    throw new FileSystemException(e);
-                } catch (final IllegalAccessException e) {
-                    throw new FileSystemException(e);
-                } catch (final InvocationTargetException e) {
+                    Array.set(convertedValues, iterValues, valueConstructor.newInstance(ctx.values[iterValues]));
+                } catch (final InstantiationException | IllegalAccessException | InvocationTargetException e) {
                     throw new FileSystemException(e);
                 }
             }
@@ -290,9 +285,7 @@ public class DelegatingFileSystemOptionsBuilder {
                 try {
                     Array.set(convertedValues, iterValues,
                             valueFactory.invoke(null, ctx.values[iterValues]));
-                } catch (final IllegalAccessException e) {
-                    throw new FileSystemException(e);
-                } catch (final InvocationTargetException e) {
+                } catch (final IllegalAccessException | InvocationTargetException e) {
                     throw new FileSystemException(e);
                 }
             }
@@ -317,9 +310,7 @@ public class DelegatingFileSystemOptionsBuilder {
         }
         try {
             configSetter.invoke(ctx.fileSystemConfigBuilder, args);
-        } catch (final IllegalAccessException e) {
-            throw new FileSystemException(e);
-        } catch (final InvocationTargetException e) {
+        } catch (final IllegalAccessException | InvocationTargetException e) {
             throw new FileSystemException(e);
         }
     }