Hello Dale,

which version of XStream are you using? What JDK (vendor and version)? Can 
you paste the output of:

================ %< ==============
$ java -cp xstream-<VERSION>.jar com.thoughtworks.xstream.core.JVM
================ %< ==============

Basically I see no reason, why a field "id" should be problematic in any 
way.

I can see quite a lot "sorted-set" types in the XML which are mapped to 
java.util.TreeSet. What is the sort criteria, e.g. for StageFieldDefinition? 
Just for looking at the XML it is not obvious. At least it is neither "id" 
nor "sequence". Is it the name that is used in the compareTo method?

Regards,
Jörg


Dale Ellis wrote:

> Hi all,
> 
> I'm facing an issue at the moment with xstream which I have pin pointed
> the problem.
> 
> I have an object called CaseType. What happens is I convert the object to
> xml, when I strip out all the id attributes and then convert it back. What
> happens is that depending on the case type object,  the fromXML() method
> just hangs forever.
> 
> The Code...
> 
>         // Remove all the ID's
>         log.debug("Null all the ids");
>         String xml = parser.toXML(contentObject);
>         String idPattern = "<id>(.+?)</id>";
>         xml = xml.replaceAll(idPattern, "");
> 
>         log.debug("Checking that export ("+ contentObject.getClass() +")
>         data can be re-imported"); Object testObject =
>         parser.fromXML(xml); log.debug("Object (" + testObject.getClass()
>         + ") Successfully imported back");
> 
> so the parser.fromXML() method hangs. If I remove the 2 lines that replace
> the id's it works fine...
> 
>         // Remove all the ID's
>         log.debug("Null all the ids");
>         String xml = parser.toXML(contentObject);
> 
>         log.debug("Checking that export ("+ contentObject.getClass() +")
>         data can be re-imported"); Object testObject =
>         parser.fromXML(xml); log.debug("Object (" + testObject.getClass()
>         + ") Successfully imported back");
> 
> In the main, removing the ID's doesn't cause an issue but for some
> CaseType objects it does. Looking into the xstream source there doesn't
> seem to be any debug I can turn on to better understand why is happening,
> I did start to step it, but looks to recursively call and I wasn't really
> following the flow.
> 
> I have attached to xml files, one is the xml with the ID's striped out,
> the other without (which works), using a compare tool, the XML looks
> exactly what I'd expect, can anyone suggest what is going on? For
> completeness here is the XStream object (parser variable) ....
> 
>     protected XStream getCaseTypeParser() {
>         XStream xStream = new XStream();
> 
>         xStream.alias("caseType", CaseType.class);
>         xStream.alias("template", CaseTypeTemplate.class);
>         xStream.alias("templateIndex", CaseTypeTemplateIndex.class);
>         xStream.alias("templateIndexData",
>         CaseTypeTemplateIndexData.class); xStream.alias("caseTypeLink",
>         CaseTypeLink.class); xStream.alias("stage",
>         StageDefinition.class); xStream.alias("stageTransition",
>         StageTransitionDefinition.class);
>         xStream.alias("stageTransitionCondition",
>         StageTransitionCondition.class);
>         xStream.alias("stageTransitionAction",
>         StageTransitionAction.class); xStream.alias("stageField",
>         StageFieldDefinition.class); xStream.alias("action",
>         CaseTypeAction.class); xStream.alias("task",
>         TaskDefinition.class); xStream.alias("field",
>         CaseTypeFieldConfig.class); xStream.alias("userValueListRule",
>         UserValueListRule.class); xStream.alias("taskTypeAction",
>         TaskTypeAction.class); xStream.alias("participantType",
>         CaseTypeParticipantType.class); xStream.alias("interactionType",
>         InteractionType.class);
> 
>         return xStream;
>     }
> 
> Thanks
> 
> Dale Ellis
> 
> 
> 
> Senior Developer
> 
> 
> 
> Serengeti Systems
> 
> Part of the Netcall group



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to