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 14:27:44 UTC

[commons-configuration] 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-configuration.git


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

commit f5dd55da1fefd41c97aaf0ddcbbcd609c8b04d77
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jan 8 09:27:38 2021 -0500

    Collapse multiple identical catch clauses into one.
---
 .../org/apache/commons/configuration2/ConfigurationUtils.java  |  6 +-----
 .../org/apache/commons/configuration2/JNDIConfiguration.java   |  7 +------
 .../org/apache/commons/configuration2/XMLConfiguration.java    | 10 +---------
 .../apache/commons/configuration2/beanutils/BeanHelper.java    |  6 +-----
 4 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java b/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
index 3491558..98128d8 100644
--- a/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
+++ b/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
@@ -421,11 +421,7 @@ public final class ConfigurationUtils
                         "No clone() method found for class"
                                 + obj.getClass().getName());
             }
-            catch (final IllegalAccessException iaex)
-            {
-                throw new ConfigurationRuntimeException(iaex);
-            }
-            catch (final InvocationTargetException itex)
+            catch (final IllegalAccessException | InvocationTargetException itex)
             {
                 throw new ConfigurationRuntimeException(itex);
             }
diff --git a/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java b/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
index 59987e3..6f14645 100644
--- a/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
+++ b/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
@@ -413,12 +413,7 @@ public class JNDIConfiguration extends AbstractConfiguration
             key = key.replaceAll("\\.", "/");
             return getBaseContext().lookup(key);
         }
-        catch (final NameNotFoundException e)
-        {
-            // expected exception, no need to log it
-            return null;
-        }
-        catch (final NotContextException nctxex)
+        catch (final NameNotFoundException | NotContextException nctxex)
         {
             // expected exception, no need to log it
             return null;
diff --git a/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java b/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
index 48299a9..5c169a5 100644
--- a/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
+++ b/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
@@ -1084,15 +1084,7 @@ public class XMLConfiguration extends BaseHierarchicalConfiguration implements
             final DocumentBuilder builder = createDocumentBuilder();
             builder.parse(new InputSource(reader));
         }
-        catch (final SAXException e)
-        {
-            throw new ConfigurationException("Validation failed", e);
-        }
-        catch (final IOException e)
-        {
-            throw new ConfigurationException("Validation failed", e);
-        }
-        catch (final ParserConfigurationException pce)
+        catch (final SAXException | IOException | ParserConfigurationException pce)
         {
             throw new ConfigurationException("Validation failed", pce);
         }
diff --git a/src/main/java/org/apache/commons/configuration2/beanutils/BeanHelper.java b/src/main/java/org/apache/commons/configuration2/beanutils/BeanHelper.java
index 9675c10..a34d6e6 100644
--- a/src/main/java/org/apache/commons/configuration2/beanutils/BeanHelper.java
+++ b/src/main/java/org/apache/commons/configuration2/beanutils/BeanHelper.java
@@ -365,11 +365,7 @@ public final class BeanHelper
         {
             BEAN_UTILS_BEAN.setProperty(bean, propName, value);
         }
-        catch (final IllegalAccessException iaex)
-        {
-            throw new ConfigurationRuntimeException(iaex);
-        }
-        catch (final InvocationTargetException itex)
+        catch (final IllegalAccessException | InvocationTargetException itex)
         {
             throw new ConfigurationRuntimeException(itex);
         }