Re: [Simple-support] De-serialization problem -- valid reference not valid?
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2009-02-17 20:05:50
|
Hi,
This looks strange, also have id= attributes been added manually? I've never seen this error before? Just wondering is there some other manipulation of the resulting XML. For example id="431" before id="438" looks odd.
Is this easy to reproduce? Would it be possible to write a test case to expose this problem, at least then I could fix the issue from a known reproducable test.
Thanks,
Niall
--- On Tue, 2/17/09, Alan Deikman <Ala...@zn...> wrote:
> From: Alan Deikman <Ala...@zn...>
> Subject: [Simple-support] De-serialization problem -- valid reference not valid?
> To: sim...@li...
> Date: Tuesday, February 17, 2009, 11:29 AM
> 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
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009,
> San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open
> Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open
> source participation
> -Receive a $600 discount off the registration fee with the
> source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|