Re: [Simple-support] CycleException: Invalid reference exception that i dont understand
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2011-07-16 01:06:08
|
Does the type have a no argument constructor? If it does and it still does not work can you send me the problem as observed in a JUnit test. I will investigate and fix then.
Thanks,
Niall
--- On Mon, 11/7/11, Mogens Hvidtfeldt <mo...@hv...> wrote:
> From: Mogens Hvidtfeldt <mo...@hv...>
> Subject: [Simple-support] CycleException: Invalid reference exception that i dont understand
> To: sim...@li...
> Received: Monday, 11 July, 2011, 2:01 PM
>
> 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.
>
>
> ------------------------------------------------------------------------------
> AppSumo Presents a FREE Video for the SourceForge Community
> by Eric
> Ries, the creator of the Lean Startup Methodology on "Lean
> Startup
> Secrets Revealed." This video shows you how to validate
> your ideas,
> optimize your ideas and identify your business strategy.
> http://p.sf.net/sfu/appsumosfdev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|