[Simple-support] De-serialization problem -- valid reference not valid?
Brought to you by:
niallg
|
From: Alan D. <Ala...@zn...> - 2009-02-17 19:46:15
|
Is the following a known bug? This is using simple-xml-2.0.2 library.
I recently upgraded so I don't know if this was showing up before.
I have two instantiations of the same class, each one contains a map
declared as follows:
@ElementMap protected TreeMap<String, Object> data;
Each instance has a map entry similar to a following:
data.put("root/source", "original");
When serialized, the overall XML looks good, but when I attempt to read
it back in, I get an error:
org.simpleframework.xml.graph.CycleException: Invalid reference '439' found
at
org.simpleframework.xml.graph.ReadGraph.getReference(ReadGraph.java:158)
at
org.simpleframework.xml.graph.ReadGraph.getInstance(ReadGraph.java:126)
at
org.simpleframework.xml.graph.ReadGraph.getElement(ReadGraph.java:107)
The XML looks like this: (I edited out other entries)
<data id="431">
<entry>
<string id="438">root/source</string>
<object class="java.lang.String" id="439">original</object>
</entry>
</data>
Then later in the file:
<data id="723">
<entry>
<string ref="438"/>
<object class="java.lang.String" ref="439"/>
</entry>
</data>
If I manually take out the ref="439" and put in some constant, it
de-serializes the way you would expect. My guess is the problem has
something to do with the the reference is to class Object and not class
java.lang.String, but the ReadGraph code that throws the exception is
doing so because it came up with a null out of the reference map. So
id="439" never seems to be making into the map. Is there a fix for this?
Thanks in advance for any help.
--
Alan Deikman
|