Skip to content

Commit 7896517

Browse files
author
Amirhossein Zamanzade
committed
[bug] Fix NullPointerException in @DateDifference when both 'from' and 'to' are null
1 parent 4158db9 commit 7896517

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/com/tosan/validation/constraints/impl/DifferenceValidator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ protected static Field findTargetField(Class rootBeanClass, String fieldName) {
4848
if (targetField != null) {
4949
return targetField;
5050
} else {
51-
logger.error("Field with name {} does not exist.", fieldName);
52-
throw new IllegalArgumentException(exception.getMessage(), exception);
51+
String exceptionMessage = "Field with name " + fieldName + " does not exist.";
52+
logger.error(exceptionMessage);
53+
throw new IllegalArgumentException(exceptionMessage, exception);
54+
5355
}
5456
}
5557

0 commit comments

Comments
 (0)