Skip to content

Issue when adding array as params, corrupts rest of the params #4

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. Create array of two strings
2. Add array as param
3. Add a second string as param
4. Observe in debug mode that 2nd param is corrupted

What is the expected output? What do you see instead?

The 2nd param looks like a serialized pointer form? Not sure.. I get something 
like this on the php side: [Ljava.lang.String;@44f42cb8

What version of the product are you using? On what operating system?

0.3.4 on Mac

Please provide any additional information below.

In file JSONRPCClient, in method protected JSONObject doRequest(String method, 
Object[] params) throws JSONRPCException

You need to change:

            if(params[i].getClass().isArray()){
                jsonParams.put(getJSONArray((Object[])params[i]));
            }

            jsonParams.put(params[i]);

to

            if(params[i].getClass().isArray()){
                jsonParams.put(getJSONArray((Object[])params[i]));
            }
            else {
                jsonParams.put(params[i]);
            }

Then everything works as expected. 

Original issue reported on code.google.com by r...@ordbogen.com on 10 Aug 2012 at 9:15

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions