Skip to content

Commit 0571695

Browse files
committed
HV-2034 Remove deprecated hibernate.validator.constraint_mapping_contributor
1 parent cd4be03 commit 0571695

File tree

4 files changed

+2
-64
lines changed

4 files changed

+2
-64
lines changed

engine/src/main/java/org/hibernate/validator/BaseHibernateValidatorConfiguration.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ public interface BaseHibernateValidatorConfiguration<S extends BaseHibernateVali
7676
*/
7777
String ALLOW_PARALLEL_METHODS_DEFINE_PARAMETER_CONSTRAINTS = "hibernate.validator.allow_parallel_method_parameter_constraint";
7878

79-
/**
80-
* @since 5.2
81-
* @deprecated planned for removal. Use hibernate.validator.constraint_mapping_contributors instead.
82-
*/
83-
@Deprecated
84-
String CONSTRAINT_MAPPING_CONTRIBUTOR = "hibernate.validator.constraint_mapping_contributor";
85-
8679
/**
8780
* Property for configuring constraint mapping contributors, allowing to set up one or more constraint mappings for
8881
* the default validator factory. Accepts a String with the comma separated fully-qualified class names of one or more

engine/src/main/java/org/hibernate/validator/internal/engine/ValidatorFactoryConfigurationHelper.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -112,35 +112,19 @@ static boolean checkPropertiesForBoolean(Map<String, String> properties, String
112112
* Returns a list with {@link ConstraintMappingContributor}s configured via the
113113
* {@link HibernateValidatorConfiguration#CONSTRAINT_MAPPING_CONTRIBUTORS} property.
114114
*
115-
* Also takes into account the deprecated {@link HibernateValidatorConfiguration#CONSTRAINT_MAPPING_CONTRIBUTOR}
116-
* property.
117-
*
118115
* @param properties the properties used to bootstrap the factory
119116
*
120117
* @return a list with property-configured {@link ConstraintMappingContributor}s; May be empty but never {@code null}
121118
*/
122119
static List<ConstraintMappingContributor> determinePropertyConfiguredConstraintMappingContributors(
123120
Map<String, String> properties, ClassLoader externalClassLoader) {
124-
@SuppressWarnings("deprecation")
125-
String deprecatedPropertyValue = properties.get( HibernateValidatorConfiguration.CONSTRAINT_MAPPING_CONTRIBUTOR );
126121
String propertyValue = properties.get( HibernateValidatorConfiguration.CONSTRAINT_MAPPING_CONTRIBUTORS );
127122

128-
if ( StringHelper.isNullOrEmptyString( deprecatedPropertyValue ) && StringHelper.isNullOrEmptyString( propertyValue ) ) {
123+
if ( StringHelper.isNullOrEmptyString( propertyValue ) ) {
129124
return Collections.emptyList();
130125
}
131126

132-
StringBuilder assembledPropertyValue = new StringBuilder();
133-
if ( !StringHelper.isNullOrEmptyString( deprecatedPropertyValue ) ) {
134-
assembledPropertyValue.append( deprecatedPropertyValue );
135-
}
136-
if ( !StringHelper.isNullOrEmptyString( propertyValue ) ) {
137-
if ( assembledPropertyValue.length() > 0 ) {
138-
assembledPropertyValue.append( "," );
139-
}
140-
assembledPropertyValue.append( propertyValue );
141-
}
142-
143-
String[] contributorNames = assembledPropertyValue.toString().split( "," );
127+
String[] contributorNames = propertyValue.split( "," );
144128
List<ConstraintMappingContributor> contributors = newArrayList( contributorNames.length );
145129

146130
for ( String contributorName : contributorNames ) {

engine/src/test/java/org/hibernate/validator/test/cfg/ConstraintMappingContributorConfiguredInValidationXmlTest.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,6 @@ public void run() {
5757
} );
5858
}
5959

60-
@Test
61-
@TestForIssue(jiraKey = "HV-1545")
62-
public void shouldApplyConstraintMappingsFromContributorsConfiguredInValidationXmlWithDeprecatedProperty() {
63-
runWithCustomValidationXml( "deprecated-constraint-mapping-contributor-validation.xml", new Runnable() {
64-
65-
@Override
66-
public void run() {
67-
Validator validator = ValidatorUtil.getValidator();
68-
69-
Set<? extends ConstraintViolation<?>> violations = validator.validate( new Marathon() );
70-
assertThat( violations ).containsOnlyViolations(
71-
violationOf( NotNull.class ).withProperty( "name" ),
72-
violationOf( Min.class ).withProperty( "numberOfHelpers" )
73-
);
74-
75-
violations = validator.validate( new Runner() );
76-
assertThat( violations ).containsOnlyViolations(
77-
violationOf( AssertTrue.class ).withProperty( "paidEntryFee" )
78-
);
79-
}
80-
} );
81-
}
82-
8360
private void runWithCustomValidationXml(String validationXmlName, Runnable runnable) {
8461
new ValidationXmlTestHelper( ConstraintMappingContributorConfiguredInValidationXmlTest.class ).runWithCustomValidationXml( validationXmlName, runnable );
8562
}

engine/src/test/resources/org/hibernate/validator/test/cfg/deprecated-constraint-mapping-contributor-validation.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)