[play-2.2 Java] Regression in form(foo.class).bindFromRequest()?

416 views
Skip to first unread message

Niklas Nylund

unread,
Sep 27, 2013, 3:08:34 AM9/27/13
to play-fr...@googlegroups.com
In 2.2 we started getting these kind of errors in our tests,

[error] Test controllers.WidgetControllerTest.setUI failed: java.lang.IllegalStateException: JSR-303 validated property 'ui' does not have a corresponding accessor for data binding - check your DataBinder's configuration (bean property versus direct field access)
[error]     at play.data.Form.bind(Form.java:343)
[error]     at play.data.Form.bindFromRequest(Form.java:215)
[error]     at controllers.Widget.setUI(Widget.java:425)


The class we are binding looks like this,

    public static class UiData
   
{
       
@Required
       
public String ui;
   
}
....

    Form<UiData> form = form(UiData.class).bindFromRequest(); // exception thrown here


Is this expected? Has something changed wrt to forms or is it a regression?

We are also seeing these types of errors, it may be related (The AddData class is similar form class):

[error] Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'apiKey' of bean class [controllers.Campaign$AddData]: Bean property 'apiKey' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?




Niklas



Ben McCann

unread,
Sep 27, 2013, 12:52:11 PM9/27/13
to play-fr...@googlegroups.com
I noticed that we weren't getting these and then started as well. We went though and added getters and setter to all our post data models to fix it. I think the change may have been in one of the 2.1.x releases. What version of Play did you upgrade from to 2.2?

Niklas Nylund

unread,
Sep 30, 2013, 3:38:37 AM9/30/13
to play-fr...@googlegroups.com
We are updating one project from 2.1.1 so you are right that the change may have been introduced earlier.

Adding setters and getters to these classes may be ok but it somewhat of a pain in the ass. We used to have small nice classes (these type of form classes usually never have any logic in them) and now we end up with lots of boilerplate, it will add hundreds if not thousand lines of useless code to our product.

Can anyone of the core devs comment on this change? What's the reasoning?

Niklas

Ben McCann

unread,
Sep 30, 2013, 3:47:22 AM9/30/13
to play-fr...@googlegroups.com
I recommend Lombok (http://projectlombok.org) in order to get around writing getters and setters


--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/dvCtLIBlBY0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
about.me/benmccann

Sushi

unread,
Oct 14, 2013, 10:25:12 AM10/14/13
to play-fr...@googlegroups.com
Hi,

I would be also interested in the reason for that!

Bests,
Sushi

Johan Andren

unread,
Oct 14, 2013, 2:25:46 PM10/14/13
to play-fr...@googlegroups.com
It's not because of the conflict with eclipse that Guillame talked about here?

Mike Nikles

unread,
Dec 18, 2013, 12:46:33 PM12/18/13
to play-fr...@googlegroups.com
We see the same problem when we deploy our app to Heroku. Any ideas on why that suddenly happens in 2.2.1? We upgraded from 2.1.1.
Reply all
Reply to author
Forward
0 new messages