XStream
  1. XStream
  2. XSTR-615

Missing reference-object during deserialization on dynamic-proxy circular reference

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.4
    • Component/s: Compatibility
    • Labels:
      None
    • JDK version and platform:
      Sun 1.5.0_22-b03 for Windows

      Description

      The deserialization of dynamic-proxies throws the following Exception when the serialized object contains circular references between dynamic-proxies: 'com.thoughtworks.xstream.converters.ConversionException: Invalid reference'.
      We tracked the issue down to the class 'com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller' line 54 (release 1.3.1).
      The problem is, that previous object's in the hierarchy representing dynamic-proxies were not put into the map 'AbstractReferenceUnmarshaller.values'.
      So when the unmarshaller encounters a XML-tag defining a reference to another dynamic-proxy the reference could not be retrieved - and the result is the previous exception.

      We provided an example as test-case '1' that reproduces the issue. None of the serialized proxy-tags with the corresponding IDs '1', '4', '7' and '10' can be found in the values-map of the AbstractReferenceUnmarshaller. The corresponding stack-trace tracks it down to this class/method.
      The handlers of most of the dynamic-proxy (IDs '2', '5' and '8' from the XML-example) are present in the stack, but none of their proxy-parents.
      The deserialization fails when the unsmarshaller is trying to receiver the object represented by the reference '7' as shown in the stack-trace.

      A test-case with PoJos instead of dynamic-proxies was successful, so circular-references in general work fine.
      Another dynamic-proxy test-case '2' with doublet-references instead of circular-references was successful too.
      The reference '14' pointing to the dynamic-proxy with the ID '14' is resolved because that proxy-object could be found in the map 'AbstractReferenceUnmarshaller.values'.
      The id-stack AbstractReferenceUnmarshaller.parentStack contains every previous object-ID for all three test-cases, so reading of IDs in general seems to work fine also.

      We did not found a similar issue to that case. Most of the issues containing 'proxies' point to specific problems with CGLib-proxies or other frameworks.
      We would be thankful for any advice or hint as circular references on dynamic-proxies are essential to our development.

      The attachements are as follows:
      1. CircularDynamicProxyXMLOutput.xml - the serialized XML of the test-case '1' that fails
      2. CircularDynamicProxyExceptionStackTrace.txt - the Exception stack-trace of the test-case '1' that fails.
      3. DoubletDynamicProxyXMLOutput.xml - the serialized XML of test-case '2' that succeeds

      1. CircularDynamicProxyExceptionStackTrace.txt
        28 kB
        Erik Binder
      2. CircularDynamicProxyXMLOutput.xml
        3 kB
        Erik Binder
      3. DoubletDynamicProxyXMLOutput.xml
        4 kB
        Erik Binder

        Issue Links

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            Erik Binder
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: