-
Dec 19th, 2011, 02:40 AM
#1
Validating Command Objects
Hi folks,
i'm just upgrading to Grails 2.0 and i have a strange compile error:
This is my command object:
class InputController {
Date datum;
String lieder;
static constraints = {
datum(blank:false, nullable:false)
lieder(blank:false, validator : {
def words = it.split(/\s+/)
boolean allRight = true
def errors = []
words.collect{
if ( it && !(it ==~ /(\D{0,2})(\d+)(\D*)/)) {
allRight = false; errors << it
}
}
def retValue = ['invalid.pattern'] + errors.join(', ')
if (!allRight) return retValue
}
)
}
And this is the error i get:
C:\Users\dietmar\Documents\NetBeansProjects\Liedve rwaltung\grails-app\controllers\LiedController.groovy: -1: The return type of java.lang.Object getErrors() in InputController$__clinit__closure1_closure2_closur e3 is incompatible with org.springframework.validation.Errors getErrors() in groovy.lang.Closure
. At [-1:-1] @ line -1, column -1.
If i comment out the validation code the compile errror is gone. I think my implementation is according to the documentation. With Grails 1.3.x there was no compilation error, and the app was running correctly.
Can someone help me?
My best regards
Dietmar
-
Dec 21st, 2011, 05:37 AM
#2
This forum seems to be not very busy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules