axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "philippe le berre (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AXIS2-5676) Deserialisation of array of obj fails if the class has a constructor(string s)
Date Wed, 12 Nov 2014 16:15:34 GMT
philippe le berre created AXIS2-5676:
----------------------------------------

             Summary: 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


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()));
---

I just don't understand the purpose of the first half of the method, which silently trap exceptions.
It works fine without it, the toArray is quite enough and doesn't induce weird assumptions
on the handled objects. 





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

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message