Issue Type: Bug Bug
Affects Versions: 1.4.4
Assignee: Jörg Schaible
Attachments: BugTest.java, in.xml, TestClass.java
Components: Core
Created: 19/Apr/13 6:13 AM
Description:

See the code attached. For a class with multiple implicit collections (an array and an ArrayList in this case), I get intermittent errors loading instances from XML, where the array field is null when it shouldn't be. Run BugTest.java with XStream libs and the input XML file on the classpath. Every few runs you get a NullPointerException trying to access the array (but it works perfectly on other runs).

I tried different variants (such as adding a 'filler' field between them), and it still occurs. I'm 99% sure that it also occurred with two ArrayLists (instead of an array and an ArrayList), so it's not specific to the array/collection combination.

It seems that making the array non-implicit fixes it (leaving the other implicit), but I need to more thoroughly test it. This seems to be independent of JRE version/vendor and OS. (Well, it occurred at least on Sun JRE 6/7 on Windows and OpenJDK 6 on Linux.)

The error occurs maybe 3 in 20 times (but is variable), and it's something caused by the 'global' initialisation code: if I do the fromXML in a loop within the code (re-instantiating the XStream object each time) I either get them all failing or none. (So I assume XStream does some initialisation in other classes that isn't redone when new XStream instances are produced.)

Project: XStream
Priority: Major Major
Reporter: Stuart Rossiter
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to