Announcement Announcement Module
Collapse
No announcement yet.
Exception on bindData Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception on bindData

    I have a form to update the properties of an object, in the controller, when doing "bindData" after receiving the parameters to bind to the object properties, one of theese parameters should be an integer, but a string is received, that generates an exception. I do not know if this behaviour is normal, or if the error should be catched automatically so it can be shown in a "<g:renderErrors bean="${...}" />"?

    The exception I get (the parameter "power" should be an integer, an "h" is received instead):


    [http-bio-8080-exec-5] ERROR 2012-03-26 11:05:29.554GMT+0200 org.codehaus.groovy.grails.web.errors.GrailsExcept ionResolver - ClassCircularityError occurred when processing request: [POST] /Prueba/car/index - parameters:
    id: 1
    _action_update: update
    name: f
    power: h
    org/springframework/beans/PropertyBatchUpdateException. Stacktrace follows:
    org.codehaus.groovy.grails.web.servlet.mvc.excepti ons.ControllerExecutionException: Executing action [update] of controller [com.vehicle.CarController] caused exception: Runtime error executing action
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: org.codehaus.groovy.grails.web.servlet.mvc.excepti ons.ControllerExecutionException: Runtime error executing action
    ... 3 more
    Caused by: java.lang.reflect.InvocationTargetException
    ... 3 more
    Caused by: java.lang.ClassCircularityError: org/springframework/beans/PropertyBatchUpdateException
    at com.vehicle.CarController$$ENSl3wrV.update(CarCont roller.groovy:19)
    ... 3 more


    The class "car" is like:


    package com.vehicle

    class Car {
    String name
    Integer power

    static constraints = {
    }
    }


    The controller does:

    def update() {
    def car = Car.get(params.id)
    bindData(car, params)

    car.save()
    render(template:"car",model:[car:car])
    }


    Tracing, the exception is generated on "bindData".

    thanks in advance.
Working...
X