Uploaded image for project: 'XML-RPC'
  1. XML-RPC
  2. XMLRPC-127

Serialization/deserialization of Map does not retain correct datatype

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.1
    • None
    • Source
    • None

    Description

      Believe that this is quite severe bug unless I did something very wrong.
      When sending/rretrieving a Map over XMLRPC the datatype is not correct. I've only checked for the keys, but the error might exist for the values as well.

      Provided is a simple unit test to illustrate the bug. To reproduce run the unit tests in SerializationTest.
      It has two test methods:

      1) one that calls a static method and
      2) and another that calls a method over XMLRPC which in turns call the same static method

      The latter fails with a ClassCastException. Instead of the key being the expected Integer it is a String.

      >From Console:
      [...]
      key: 21
      value: twentyone
      21 -> 'twentyone'
      key: 1
      value: one
      1 -> 'one'
      [...]
      key: 21

      >From Debug -> Variables (in Eclipse):

      entry HashMap$Entry<K,V> (id=13)
      key "21"
      count 2
      hash 1599
      offset 0
      value char[2] (id=27)
      value "twentyone"
      count 9
      hash 0
      offset 0
      value char[9] (id=29)

      As you can see 21 is a char[2] and not an integer as expected.

      Attachments

        1. test.zip
          8 kB
          Jimisola Laursen

        Activity

          People

            Unassigned Unassigned
            jimisola Jimisola Laursen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: