Skip to content

Commit 49c11c6

Browse files
marko-bekhtagsmet
authored andcommitted
HV-1623 Replace empty check in Contracts with null and empty check at the same time
- based on our usage of not empty check passed parameters should not be null as well hence the implementation of the check can use StringHelper.isNullOrEmptyString utility method.
1 parent cd64f25 commit 49c11c6

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

engine/src/main/java/org/hibernate/validator/internal/cfg/context/TypeConstraintMappingContextImpl.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ public PropertyConstraintMappingContext property(String property, ElementType el
134134

135135
@Override
136136
public PropertyConstraintMappingContext field(String property) {
137-
Contracts.assertNotNull( property, "The property name must not be null." );
138137
Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() );
139138

140139
JavaBeanField javaBeanField = getFieldProperty( beanClass, property );
@@ -155,7 +154,6 @@ public PropertyConstraintMappingContext field(String property) {
155154

156155
@Override
157156
public PropertyConstraintMappingContext getter(String property) {
158-
Contracts.assertNotNull( property, "The property name must not be null." );
159157
Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() );
160158

161159
JavaBeanGetter javaBeanGetter = getGetterProperty( beanClass, property );

engine/src/main/java/org/hibernate/validator/internal/util/Contracts.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static void assertTrue(boolean condition, String message, Object... messa
7575
}
7676

7777
public static void assertNotEmpty(String s, String message) {
78-
if ( s.length() == 0 ) {
78+
if ( StringHelper.isNullOrEmptyString( s ) ) {
7979
throw LOG.getIllegalArgumentException( message );
8080
}
8181
}

0 commit comments

Comments
 (0)