[ 
https://issues.apache.org/jira/browse/WICKET-2624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marat Radchenko updated WICKET-2624:
------------------------------------

    Attachment: PropertyResolverTest.java

> 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$directfieldsetwithdifferenttypethanget...@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.

Reply via email to