You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (Commented) (JIRA)" <ji...@apache.org> on 2011/11/27 12:58:40 UTC

[jira] [Commented] (WICKET-4259) Using an IValidator on an AjaxEditableLabel causes ClassCastException

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

Martin Grigorov commented on WICKET-4259:
-----------------------------------------

It is interesting why it works in 1.4.x ?
Is PropertyModel smarter in 1.4.x ? Did we lose some functionality ?
                
> Using an IValidator on an AjaxEditableLabel causes ClassCastException
> ---------------------------------------------------------------------
>
>                 Key: WICKET-4259
>                 URL: https://issues.apache.org/jira/browse/WICKET-4259
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.5.3
>            Reporter: Stefan Schulte
>            Priority: Minor
>         Attachments: WICKET-4259.patch, myproject1_4_19.zip, myproject1_5_3.zip
>
>
> AjaxEditableLabel<Integer> label = new AjaxEditableLabel<Integer>("label", new PropertyModel<Integer>(this, "value"));
> form.add(label);
> label.setRequired(true);
> label.add(new RangeValidator<Integer>(1, 10));
> Using a RangeValidator<Integer> on an AjaxEditableLabel<Integer>  causes an ClassCastException after editing the label. 
> java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
> This can be avoided by setting the type explicit on the AjaxEditableLabel.
> label.setType(Integer.class);
> But this wasn't necessary in Wicket 1.4.19. In this version all works fine without setting the type explicit.
> I found out, that AbstractTextComponent.resolveType() is not able to get the type of the DefaultModel of the AjaxEditableLabel in Wicket 1.5.3.
> I will attach two QuickStarts to demonstrate the bug. One with wicket 1.4.19 and the other with Wicket 1.5.3

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira