Skip to content

Commit b982f2c

Browse files
committed
Fields{Match,Mismatch}Validator: declare variable right before its usage.
Reported by PMD. No functional changes.
1 parent 83fcd86 commit b982f2c

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/main/java/ru/mystamps/web/validation/jsr303/FieldsMatchValidator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ public boolean isValid(final Object value, final ConstraintValidatorContext ctx)
4646

4747
try {
4848
final String firstFieldValue = BeanUtils.getProperty(value, firstFieldName);
49-
final String secondFieldValue = BeanUtils.getProperty(value, secondFieldName);
50-
5149
if (isNullOrEmpty(firstFieldValue)) {
5250
return true;
5351
}
5452

53+
final String secondFieldValue = BeanUtils.getProperty(value, secondFieldName);
5554
if (isNullOrEmpty(secondFieldValue)) {
5655
return true;
5756
}

src/main/java/ru/mystamps/web/validation/jsr303/FieldsMismatchValidator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ public boolean isValid(final Object value, final ConstraintValidatorContext ctx)
4646

4747
try {
4848
final String firstFieldValue = BeanUtils.getProperty(value, firstFieldName);
49-
final String secondFieldValue = BeanUtils.getProperty(value, secondFieldName);
50-
5149
if (isNullOrEmpty(firstFieldValue)) {
5250
return true;
5351
}
5452

53+
final String secondFieldValue = BeanUtils.getProperty(value, secondFieldName);
5554
if (isNullOrEmpty(secondFieldValue)) {
5655
return true;
5756
}

0 commit comments

Comments
 (0)