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:34:16 UTC
[commons-validator] 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-validator.git
The following commit(s) were added to refs/heads/master by this push:
new 366fd7a Collapse multiple identical catch clauses into one.
366fd7a is described below
commit 366fd7a72a08c07ed89538e6582e4502c37bd61b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jan 8 10:34:12 2021 -0500
Collapse multiple identical catch clauses into one.
Remove unused import.
---
.../org/apache/commons/validator/ValidatorAction.java | 15 ++-------------
.../org/apache/commons/validator/util/ValidatorUtils.java | 6 +-----
2 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/src/main/java/org/apache/commons/validator/ValidatorAction.java b/src/main/java/org/apache/commons/validator/ValidatorAction.java
index 2b9ff61..90abd9c 100644
--- a/src/main/java/org/apache/commons/validator/ValidatorAction.java
+++ b/src/main/java/org/apache/commons/validator/ValidatorAction.java
@@ -551,9 +551,7 @@ public class ValidatorAction implements Serializable {
getValidationClassInstance(),
paramValues);
- } catch (IllegalArgumentException e) {
- throw new ValidatorException(e.getMessage());
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw new ValidatorException(e.getMessage());
} catch (InvocationTargetException e) {
@@ -692,16 +690,7 @@ public class ValidatorAction implements Serializable {
if (this.instance == null) {
try {
this.instance = this.validationClass.newInstance();
- } catch (InstantiationException e) {
- String msg1 =
- "Couldn't create instance of "
- + this.classname
- + ". "
- + e.getMessage();
-
- throw new ValidatorException(msg1);
-
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
String msg1 =
"Couldn't create instance of "
+ this.classname
diff --git a/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java b/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java
index 3e49828..da92df1 100644
--- a/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java
+++ b/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java
@@ -104,11 +104,7 @@ public class ValidatorUtils {
try {
value = PropertyUtils.getProperty(bean, property);
- } catch(IllegalAccessException e) {
- LOG.error(e.getMessage(), e);
- } catch(InvocationTargetException e) {
- LOG.error(e.getMessage(), e);
- } catch(NoSuchMethodException e) {
+ } catch(IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
LOG.error(e.getMessage(), e);
}