Re: [Simple-support] Invalid reference '16' found. On empty String object (not null)
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2008-05-20 18:31:31
|
Hi Lorenzo, One issue with serializing strings is that an empty string is null. See: http://simple.sourceforge.net/download/stream/report/cobertura/org.simpleframework.xml.stream.NodeReader.html Is this a handwritten XML document or is this one that was serialized and can not be deserialized? If so then this is a bug I will have to tend to. To fix this you can make a change in this file: http://simple.sourceforge.net/download/stream/report/cobertura/org.simpleframework.xml.graph.ReadGraph.html Such that if it is null then it returns a Reference oject instead of throwing an exception. It should return. return new Reference(null, real); This should sort out the issue, however if references are being created to a null value this is a bug. Could you let me know if this is the case? Hope this helps, Niall --- Lorenzo Dal Col <lor...@gm...> wrote: > Hello, I'm trying to use Simple XML Serialization > for saving a big > object into files. > I have circular references, so I use CycleStrategy. > > The problem is that if I save some fields that are > empty Strings, it > uses only one object, all the others are references: > > <tables id="7"> > <entry> > <string id="8">m_units</string> > <tableInfo id="9"> > <fields id="10"> > [...] > <entry> > <string id="14">descrizione</string> > <fieldInfo id="15"> > <fieldName reference="14"/> > <columnDefault > id="16"></columnDefault> > <isNullable>false</isNullable> > <dataType id="17">STRING</dataType> > <parentTable reference="9"/> > </fieldInfo> > </entry> > [...] > <entry> > <string id="151">ragsoc</string> > <fieldInfo id="152"> > <fieldName reference="151"/> > <columnDefault reference="16"/> > <isNullable>false</isNullable> > <dataType reference="17"/> > <parentTable reference="127"/> > </fieldInfo> > </entry> > [...] > > But when I try to load this I get: Invalid reference > '16' found. > Am I doing something wrong? > > the Object I'm trying to save is like this: > > @Root > public class FieldInfo { > @Element(required=false) > public String fieldName; > @Element(required=false) > public String columnDefault; > @Element(required=false) > public boolean isNullable; > @Element(required=false) > public DATA_TYPE dataType; > @Element(required=false) > public TableInfo parentTable; > } > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio > 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |