Hi

While i worked on the cli issue [1], found that json which received from
the Rest endpoint is not backward compatible with the object again. Eg:
Rest call is:

@GET
    @Path("/partition")
    @Produces("application/json")
    @Consumes("application/json")
    @AuthorizationAction("/permission/protected/manage/monitor/tenants")
    public Partition[] getPartitions () throws RestAPIException {

        return ServiceUtils.getAvailablePartitions();
    }

The Partition Pojo is:

@XmlRootElement
public class Partition {

    public String id;

    public int partitionMin;

    public int partitionMax;

    public String provider;

    public List<PropertyBean> property;
}

This should result as:

{"partition":[{"id":"P2","partitionMin":0,"partitionMax":0,"provider":"ec2","property":
*[*{"name":"region","value":"ap-southeast-1"}*]*}]}

but the actual response is when getPartitions from SM without the array
type for the property:

{"partition":[{"id":"P2","partitionMin":0,"partitionMax":0,"provider":"ec2","property":{"name":"region","value":"ap-southeast-1"}}]}

So that the parser failed in cli to parse this string into Object. When i
tested it with more than one property, it takes the property as an array.

Did anyone observer such behavior? How can we handle this?

[1]. https://issues.apache.org/jira/browse/STRATOS-383

Thanks,
Reka

-- 
Reka Thirunavukkarasu
Software Engineer,
WSO2, Inc.:http://wso2.com,
Mobile: +94776442007

Reply via email to