Greglacave / android-xmlrpc

Automatically exported from code.google.com/p/android-xmlrpc
0 stars 0 forks source link

xmlrpc reverses order of data #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It looks like this library reverses order of data exposed by server. If i.e. 
server returns:

key1 = val1
key2 = val2

I get 

key2 = val2
key1 = val1

It's not a major issue, yet sometimes order matters if method you are calling 
is expected to return sorted data. Sure you can sort things yourself but that a 
waste anyway.

Original issue reported on code.google.com by borszc...@gmail.com on 3 Aug 2011 at 4:53

GoogleCodeExporter commented 9 years ago
I'm struggling to see where this is occurring in the code (and in fact, was 
never aware of it happening). Is there any chance you can step through your 
code and check whether the issue might perhaps be occurring for you at line 181 
of XMLRPCSerializer.java?

http://code.google.com/p/android-xmlrpc/source/browse/trunk/XMLRPC/src/org/xmlrp
c/android/XMLRPCSerializer.java#181

It may be that list.add is adding the entry to the top of the array rather than 
the bottom, but, like I said, I wasn't aware of it happening.

Original comment by jon@sprig.gs on 3 Aug 2011 at 7:50

GoogleCodeExporter commented 9 years ago
I guess you have this problem within the struct element?
If so, you are anyway not allowed to rely on the order of the elements.
The specification explicit says: "The struct element does not preserve the 
order of the keys. The two structs are equivalent." - see 
http://www.xmlrpc.com/spec

I guess this has been specificated so that there is no problem in using 
HashMaps that (depending on the hash function) do not preserve element order.

Original comment by tim.roes88@googlemail.com on 20 Oct 2011 at 5:01