Results 1 to 2 of 2

Thread: Validating Command Objects

  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Default 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

  2. #2
    Join Date
    Dec 2011
    Posts
    2

    Default

    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
  •