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

philippe le berre updated AXIS2-5676:
-------------------------------------
    Attachment: ConverterUtil_patch.diff

Patch for ConverterUtil

> Deserialisation of array of obj fails if the class has a constructor(string s)
> ------------------------------------------------------------------------------
>
>                 Key: AXIS2-5676
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5676
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.6.2
>            Reporter: philippe le berre
>         Attachments: ConverterUtil_patch.diff, test_patch.diff
>
>
> For instance,
> public class Alice {
> private String comment;
> private String name;
> public Alice();
> public Alice(String comment)  {this.comment = comment; }
> public String toString() { return "[name:"+name+", comment:"+comment+"]"; }
> }
> if invoking :
> client.setReturnType(new Class[] {  Alice[].class });
> Alice[] ar = (Alice[]) client.invokeBlocking(new Object[3]);
> Then the deserialised array contains object instantiated with calls to 
> Alice(obj.toString()). If one removes the Alice(String s) constructor then 
> the array is correct, Alice objects are instantiated properly.
> The root cause is the method ConvertToArbitraryObjectArray in 
> org.apache.axis2.databinding.utils.ConverterUtil
> ---
>                        Array.set(returnArray, i, getObjectForClass(
>                                 baseArrayClass,
>                                 o.toString()));
> ---
> The one test that refers to this is testBigInteger in ConverterUtilTest, so I 
> propose the following fix :
>       if (! ADBBean.class.isAssignableFrom(baseArrayClass) && 
>                       
> java.lang.Number.class.isAssignableFrom(baseArrayClass)) {
> The ConvertUtilTest is then ok, as well as any array of Alice !



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to