Menu

#26 Predictable ordering on structured data

open
nobody
None
5
2010-07-30
2010-07-30
Anonymous
No

If I attempt to utilize any ordered structure (LinkedHashMap, TreeMap, SortedSet, etc.) as a return value for a server invocation, the resulting values on the client side come back as a regular HashMap which means the ordering of values is usually corrupted. While I see how I am able to create a custom serializer on the server side, I see no means of creating a custom deserializer on the client side so that I can parse the serialized XML in the same order it is received.

Generally speaking, I find this to be a bug. The deserialized content should be returned in the same order it was serialized and not reordered at the client side simply because the deserializer uses a HashMap rather than a LinkedHashMap which would provide predictable FIFO ordering.

Discussion

  • Anonymous

    Anonymous - 2010-07-30

    I was able to resolve this very easily in the source code simply by making XmlRpcStruct inherit from LinkedHashMap rather than HashMap. This results in a structure whose ordering is identical to that was was serialized from the server.

     
  • Nobody/Anonymous

    Patch to yield predictable ordering of serialized structures.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.