[Simple-support] CycleException: Invalid reference exception that i dont understand
Brought to you by:
niallg
|
From: Mogens H. <mo...@hv...> - 2011-07-11 21:01:16
|
I am hitting the invalid reference exception when i read an xml. The xml was
created by Simple framework using the CycleStrategy but is fails when I try
to deserialize file.
// This is how I read the file
Strategy cycleStrategry = new CycleStrategy("id", "ref");
Strategy annotationStrategy = new AnnotationStrategy(cycleStrategry);
Serializer s = new Persister(annotationStrategy);
s.read(Project.class, file, false);
// This is the xml I am trying to read
<project id="0">
<uuid id="1">09611242-348c-4224-bdeb-008d4499c09e</uuid>
<createdDate id="2">2011-07-11 22:34:41.326 GMT+02:00</createdDate>
<name id="3">undefined</name>
<plates class="java.util.ArrayList" id="4">
<plate id="5">
<project ref="0"/>
<images class="java.util.ArrayList" id="6">
<image id="7">
<createdDate id="8">2011-07-11 22:34:46.502
GMT+02:00</createdDate>
<id id="9">d56bfad7-ed89-4c65-ba7f-35bfce7e115f</id>
<plate ref="5"/>
</image>
</images>
<name id="10">Plate A</name>
<id id="11">-1</id>
<referenceLayerIndex id="12">0</referenceLayerIndex>
</plate>
</plates>
<results class="java.util.ArrayList" id="13">
<result
class="com.ToolboxFactory.ColonyCount.Result.SampleConcentrationResult"
id="14">
<transfers class="java.util.ArrayList" id="15"/>
</result>
<result class="com.ToolboxFactory.ColonyCount.Result.TagRatioResult"
id="16">
<project ref="0"/>
</result>
</results>
<autoSave id="17">false</autoSave>
</project>
// This is the exception i get
org.simpleframework.xml.strategy.CycleException: Invalid reference '5' found
But reference 5 should be valid and the type of the <plate id="5"> class is
the same as the one defined in the property <plate ref="5"/> (otherwise the
serialization would not have defined the reference).
Any ideas would be appreciated
--
View this message in context: http://old.nabble.com/CycleException%3A-Invalid-reference-exception-that-i-dont-understand-tp32041293p32041293.html
Sent from the Simple XML Serialization mailing list archive at Nabble.com.
|