Skip to content

Commit ee9e70d

Browse files
author
nebolsin
committed
fix for GRAILS-1544
git-svn-id: https://svn.codehaus.org/grails/trunk@5327 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d
1 parent 1e13374 commit ee9e70d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/commons/org/codehaus/groovy/grails/validation/ConstrainedProperty.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ public static void registerNewConstraint(String name, ConstraintFactory factory)
209209
constraints.put(name, factory);
210210
}
211211

212+
public static boolean hasRegisteredConstraint( String constraintName ) {
213+
return constraints.containsKey( constraintName );
214+
}
215+
212216

213217
/**
214218
* @return Returns the appliedConstraints.

src/commons/org/codehaus/groovy/grails/validation/ConstrainedPropertyBuilder.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ protected Object createNode(Object name, Map attributes) {
6868
if(cp.supportsContraint(constraintName)) {
6969
cp.applyConstraint(constraintName, attributes.get(constraintName));
7070
} else {
71-
GrailsUtil.warn( "Property [" + cp.getPropertyName() + "] of type [" + cp.getPropertyType().getName() + "] doesn't support constraint [" + constraintName + "]. This constraint will not be checked during validation." );
71+
if( ConstrainedProperty.hasRegisteredConstraint( constraintName ) ) {
72+
// constraint is registered but doesn't support this property's type
73+
GrailsUtil.warn( "Property [" + cp.getPropertyName() + "] of domain class " + this.target.getClass().getName() + " has type [" + cp.getPropertyType().getName() + "] and doesn't support constraint [" + constraintName + "]. This constraint will not be checked during validation." );
74+
}
7275
}
7376
}
7477
return cp;

0 commit comments

Comments
 (0)