Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Not A Bug
-
Affects Version/s: 1.3.1
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
JDK version and platform:Sun 1.6.0_10-b33
Description
Hi
I've serialized a object using XStream, but when I tried to deserialize it, an exception was thrown:
com.thoughtworks.xstream.io.StreamException: : Character reference "�" is an invalid XML character.
at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:86)
at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:70)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)
at com.thoughtworks.xstream.EscapeXmlSpecialCharactes.testSharp(EscapeXmlSpecialCharactes.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.xml.sax.SAXParseException: Character reference "�" is an invalid XML character.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:79)
... 21 more
I'am attaching JUnit test. The string that I'am serializing is just "\0".
The console output of the test is:
<com.thoughtworks.xstream.StringHolder>
<data>�</data>
</com.thoughtworks.xstream.StringHolder>
[Fatal Error] :2:14: Character reference "�" is an invalid XML character.
Best regards
Kiril
This is correct behaviour: http://xstream.codehaus.org/faq.html#XML_null_char. For further questions, please ask on the list.