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

ASF GitHub Bot commented on WICKET-5692:
----------------------------------------

GitHub user tkruse opened a pull request:

    https://github.com/apache/wicket/pull/77

    Wicket 5692: Better error message when property cannot be resolved

    See https://issues.apache.org/jira/browse/WICKET-5692
    
    commits can be squashed one review passed.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tkruse/wicket wicket-5692

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/wicket/pull/77.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #77
    
----
commit 8c0a821addd6d20914485d990ad21acb93081585
Author: Thibault Kruse <thibault.kr...@comsysto.com>
Date:   2014-09-22T20:08:19Z

    Reproduce flawed Error message (to demonstrate wicket-5692)

commit 4d1c7046a23c0cf56e89e8f5261d9525e95d09b2
Author: Thibault Kruse <thibault.kr...@comsysto.com>
Date:   2014-09-22T20:10:04Z

    WICKET-5692: improved Unresolvable Property Message

----


> 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