Author: hardy.ferentschik
Date: 2009-06-04 05:17:14 -0400 (Thu, 04 Jun 2009)
New Revision: 16690
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintHelper.java
Log:
Raising an exception now in case ther groups default value is not the empty array
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintHelper.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintHelper.java 2009-06-03
22:29:24 UTC (rev 16689)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintHelper.java 2009-06-04
09:17:14 UTC (rev 16690)
@@ -258,16 +258,24 @@
}
catch ( Exception e ) {
String msg = annotation.annotationType().getName() + " contains Constraint
annotation, but does " +
- "not contain a message parameter. Annotation is getting ignored.";
+ "not contain a message parameter.";
throw new ConstraintDefinitionException( msg );
}
try {
- ReflectionHelper.getAnnotationParameter( annotation, "groups", Class[].class
);
+ Class<?>[] defaultGroups = ( Class<?>[] ) annotation.annotationType()
+ .getMethod( "groups" )
+ .getDefaultValue();
+ if ( defaultGroups.length != 0 ) {
+ String msg = annotation.annotationType()
+ .getName() + " contains Constraint annotation, but the groups " +
+ "paramter default value is not empty.";
+ throw new ConstraintDefinitionException( msg );
+ }
}
- catch ( Exception e ) {
+ catch ( NoSuchMethodException nsme ) {
String msg = annotation.annotationType().getName() + " contains Constraint
annotation, but does " +
- "not contain a groups parameter. Annotation is getting ignored.";
+ "not contain a groups parameter.";
throw new ConstraintDefinitionException( msg );
}
Show replies by date