This is an automated email from the ASF dual-hosted git repository.
sebb 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 7bfb88f Simplify; avoid hiding instances variables
7bfb88f is described below
commit 7bfb88f4e98034d78c5a170c59e4838759bc5f2e
Author: Sebb <[email protected]>
AuthorDate: Sat Jul 25 22:16:12 2020 +0100
Simplify; avoid hiding instances variables
---
.../java/org/apache/commons/validator/Validator.java | 4 ++--
.../org/apache/commons/validator/ValidatorAction.java | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/main/java/org/apache/commons/validator/Validator.java
b/src/main/java/org/apache/commons/validator/Validator.java
index 8b29df2..f8c4f97 100644
--- a/src/main/java/org/apache/commons/validator/Validator.java
+++ b/src/main/java/org/apache/commons/validator/Validator.java
@@ -109,7 +109,7 @@ public class Validator implements Serializable {
* Maps validation method parameter class names to the objects to be passed
* into the method.
*/
- protected Map<String, Object> parameters = new HashMap<String, Object>();
// <String, Object>
+ protected Map<String, Object> parameters = new HashMap<>(); // <String,
Object>
/**
* The current page number to validate.
@@ -278,7 +278,7 @@ public class Validator implements Serializable {
public void clear() {
this.formName = null;
this.fieldName = null;
- this.parameters = new HashMap<String, Object>();
+ this.parameters = new HashMap<>();
this.page = 0;
}
diff --git a/src/main/java/org/apache/commons/validator/ValidatorAction.java
b/src/main/java/org/apache/commons/validator/ValidatorAction.java
index 84973b1..2b9ff61 100644
--- a/src/main/java/org/apache/commons/validator/ValidatorAction.java
+++ b/src/main/java/org/apache/commons/validator/ValidatorAction.java
@@ -155,7 +155,7 @@ public class ValidatorAction implements Serializable {
* An internal List representation of all the validation method's
* parameters defined in the methodParams String.
*/
- private final List<String> methodParameterList = new ArrayList<String>();
+ private final List<String> methodParameterList = new ArrayList<>();
/**
* Gets the name of the validator action.
@@ -447,13 +447,13 @@ public class ValidatorAction implements Serializable {
* ClassLoader.getResourceAsStream() method.
*/
private String formatJavascriptFileName() {
- String name = this.jsFunction.substring(1);
+ String fname = this.jsFunction.substring(1);
if (!this.jsFunction.startsWith("/")) {
- name = jsFunction.replace('.', '/') + ".js";
+ fname = jsFunction.replace('.', '/') + ".js";
}
- return name;
+ return fname;
}
/**
@@ -693,22 +693,22 @@ public class ValidatorAction implements Serializable {
try {
this.instance = this.validationClass.newInstance();
} catch (InstantiationException e) {
- String msg =
+ String msg1 =
"Couldn't create instance of "
+ this.classname
+ ". "
+ e.getMessage();
- throw new ValidatorException(msg);
+ throw new ValidatorException(msg1);
} catch (IllegalAccessException e) {
- String msg =
+ String msg1 =
"Couldn't create instance of "
+ this.classname
+ ". "
+ e.getMessage();
- throw new ValidatorException(msg);
+ throw new ValidatorException(msg1);
}
}
}