You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Johan Compagner (JIRA)" <ji...@apache.org> on 2009/12/17 16:11:18 UTC

[jira] Commented: (WICKET-2624) MethodGetAndSet.setValue uses wrong source to determine which type to convert to when there's no setter

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

Johan Compagner commented on WICKET-2624:
-----------------------------------------

that the type is not used is a bug.
But  that if (set != null) is on purpose

getMethod is always there and if the value will be set throough a setMethod then the getMethod return type will be its type.
(else we have to look at the parameters if the setter but getting the return type is quicker)


> MethodGetAndSet.setValue uses wrong source to determine which type to convert to when there's no setter
> -------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-2624
>                 URL: https://issues.apache.org/jira/browse/WICKET-2624
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.4
>            Reporter: Marat Radchenko
>         Attachments: PropertyResolverTest.java
>
>
> MethodGetAndSet.setValue uses wrong source to determine which type to convert to when there's no setter, resulting in exceptions like this:
> org.apache.wicket.WicketRuntimeException: Error setting field: private int PropertyResolverTest$DirectFieldSetWithDifferentTypeThanGetter.value on object: PropertyResolverTest$DirectFieldSetWithDifferentTypeThanGetter@396477d9
> 	at org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(PropertyResolver.java:1150)
> 	at org.apache.wicket.util.lang.PropertyResolver$ObjectAndGetSetter.setValue(PropertyResolver.java:588)
> 	at org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.java:136)
> 	at PropertyResolverTest.testDirectFieldSetWithDifferentTypeThanGetter(PropertyResolverTest.java:12)
> Bug is located in:
> converted = converter.convert(value, getMethod.getReturnType());
> Instead, it should read:
> converted = converter.convert(value, type);
> Testcase attached.
> Additional thoughts:
> if (setMethod != null)
> {
>   type = getMethod.getReturnType();
> }
> This is really confusing (we check setMethod presence but get type from getMethod). Luckily, this works as expected because in MethodGetAndSet.findSetter only methods with same (or superclass) type as getter are returned.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.