[ 
https://issues.apache.org/jira/browse/WICKET-5692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14143797#comment-14143797
 ] 

ASF subversion and git services commented on WICKET-5692:
---------------------------------------------------------

Commit fe66a3836f87c7a98eb48a1c7432d4c7160036f3 in wicket's branch 
refs/heads/wicket-6.x from [~tkruse]
[ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=fe66a38 ]

WICKET-5692: improved Unresolvable Property Message

(cherry picked from commit 09fc316b768968f99c2a80bda1dbaee7a596eb12)


> Misleading message in PropertyValidator
> ---------------------------------------
>
>                 Key: WICKET-5692
>                 URL: https://issues.apache.org/jira/browse/WICKET-5692
>             Project: Wicket
>          Issue Type: Improvement
>            Reporter: Thibault Kruse
>            Priority: Minor
>
> in org.apache.wicket.bean.validation.PropertyValidator.java:
> {code}
> if (property_ == null)
>                       {
>                               throw new IllegalStateException(
>                                       "Could not resolve Property from 
> component: " +
>                                               component +
>                                               ". Either specify the Property 
> in the constructor or use a model that works in combination with a " +
>                                               
> IPropertyResolver.class.getSimpleName() +
>                                               " to resolve the Property 
> automatically");
>                       }
> {code}
> The error message is misleading, as other causes might lead to a result of 
> null. As PropertyResolvers can be of any type, the message should not assume 
> any given cause, but may hint at common errors.
> In particular in my case when Using a bean Foo having a field bar of Type 
> Bar, and a Model on an instance foo of Foo having null for field bar.
> Instead, it would be nice if the Error Message made an attempt to cast the 
> component model to AbstractPropertyModel and print the propertyExpression, as 
> well as the type of the modelObject, but without failure if the cast is not 
> possible, and reporting the modelObject is null if so.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to