Details
-
Type: Bug
-
Status: Closed
-
Resolution: Cannot Reproduce
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
JDK version and platform:Sun 1.5.0_03 for Windows
Description
A String array field is declared in a class as follows:
private String[] setPointCmds;
In an instance of this class, the field is initialised to null, then serialised by XStream:
setPointCmds = null;
...
x = new XStream();
x.toXML(instance, outputStream);
The output is for that field is:
<setPointCmds>
<null/>
</setPointCmds>
When this is deserialized, it creates an instance of the class with the field setPointCmds set to an array of length one with the value at index 0 equal to null, instead of being initialised to null.
Hi Bruce,
which version of XStream you're using? I've checked in a unit test for this, but I cannot reproduce your case. If you set the member to null, nothing is generated in the XML representation. Please reopen, if you can provide a unit test for the current version, that demonstrates this issue.