XStream
  1. XStream
  2. XSTR-161

Problem unmarshalling UnmodifiableCollection

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: 1.1.2
    • Component/s: None
    • Labels:
      None

      Description

      I have an object containing a java.util.Collection which is in fact an UnmodifiableCollection (obtained by calling Collections.unmodifiableCollection(aCollection)).

      The XML serialized form of this object is :
      ...
      <securityContext>
      <securityGroups class="java.util.Collections-UnmodifiableCollection">
      <c class="list">
      <string>Guichetier</string>
      </c>
      </securityGroups>
      </securityContext>
      ...

      The XML marshalling works, but not the unmarshalling.
      I get the following error :

      com.thoughtworks.xstream.converters.ConversionException: Cannot construct java.util.Collections$UnmodifiableCollection: java/util/Collections$UnmodifiableCollection
      ---- Debugging information ----
      required-type : java.util.Collections$UnmodifiableCollection
      cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
      cause-message : Cannot construct java.util.Collections$UnmodifiableCollection: java/util/Collections$UnmodifiableCollection
      message : Cannot construct java.util.Collections$UnmodifiableCollection: java/util/Collections$UnmodifiableCollection
      class : ibp.ate.common.context.UserEnvironmentImpl
      path : /ibp.ate.common.context.UserEnvironmentImpl/securityContext/securityGroups
      -------------------------------
      at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(Unknown Source)
      at com.thoughtworks.xstream.core.ReferenceByXPathUnmarshaller.convertAnother(Unknown Source)
      at com.thoughtworks.xstream.converters.reflection.ReflectionConverter.unmarshal(Unknown Source)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(Unknown Source)
      at com.thoughtworks.xstream.core.ReferenceByXPathUnmarshaller.convertAnother(Unknown Source)
      at com.thoughtworks.xstream.converters.reflection.ReflectionConverter.unmarshal(Unknown Source)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(Unknown Source)
      at com.thoughtworks.xstream.core.ReferenceByXPathUnmarshaller.convertAnother(Unknown Source)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.start(Unknown Source)
      at com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(Unknown Source)
      at com.thoughtworks.xstream.XStream.unmarshal(Unknown Source)
      at com.thoughtworks.xstream.XStream.fromXML(Unknown Source)
      at com.thoughtworks.xstream.XStream.fromXML(Unknown Source)

        People

        • Assignee:
          Unassigned
          Reporter:
          GIlles Figoni
        • Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: