Hi,
We recently added a new custom constraint and it is working perfectly. We then added a second, similar custom constraint, but when we deploy, we get the following exception:
Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI definition failure:Exception List with 1 exceptions:
Exception 0 :
java.lang.ArrayIndexOutOfBoundsException: 0
at org.hibernate.validator.internal.util.ReflectionHelper.parametersResolveToSameTypes(ReflectionHelper.java:755)
at org.hibernate.validator.internal.util.ReflectionHelper.overrides(ReflectionHelper.java:726)
at org.hibernate.validator.internal.cdi.ValidationExtension.replaceWithOverriddenOrInterfaceMethod(ValidationExtension.java:389)
at org.hibernate.validator.internal.cdi.ValidationExtension.determineConstrainedMethod(ValidationExtension.java:214)
at org.hibernate.validator.internal.cdi.ValidationExtension.determineConstrainedCallables(ValidationExtension.java:201)
at org.hibernate.validator.internal.cdi.ValidationExtension.processAnnotatedType(ValidationExtension.java:181)
...
__________________
Here are the relevant pieces of code:
The Annotation:
Code:
@Target({TYPE, ANNOTATION_TYPE})
@Retention(RUNTIME)
@Constraint(validatedBy = {DatasetFieldValidator.class})
@Documented
public @interface ValidateDatasetField {
String message() default "Required";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
The Validator
Code:
public class DatasetFieldValidator implements ConstraintValidator<ValidateDatasetField, DatasetField> {
@Override
public void initialize(ValidateDatasetField constraintAnnotation) {
}
@Override
public boolean isValid(DatasetField value, ConstraintValidatorContext context) {
...
return true;
}
}
The entity to be validated:
Code:
@Entity
@ValidateDatasetField
public class DatasetField implements Serializable {
Like I said, when I look at the code of the the other validator, it looks very parallel and it works.
Any ideas?