Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.0
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
Now that the default driver for new XStream() is the XppDriver, there seems to be a dependency on the XPP3 library in the xstream.fromXML(String) method. However, according to the commit comment of XStream.java, revision 1.42, XPP3 should still be optional...
"Default XStream constructor uses XPP3. Updated docs to recommend including this jar (although it is still optional)"
The dependency is apparent in the XStreamSerializationTestCase.java, revision 1.1, in the Picocontainer CVS.
http://cvs.picocontainer.codehaus.org/java/picocontainer/src/test/org/picocontainer/defaults/XStreamSerialisationTestCase.java
In it, new XStream() is used, implicitly using the XppDriver (although an explicit DomDriver has been used in revision 1.2 to avoid this problem). Here's the error...
Testcase: testShouldBeAbleToSerialiseEmptyPico(org.picocontainer.defaults.XStreamSerialisationTestCase): Caused an ERROR
XPP3 pull parser library not present. Specify another driver. For example: new XStream(new DomDriver())
java.lang.IllegalArgumentException: XPP3 pull parser library not present. Specify another driver. For example: new XStream(new DomDriver())
at com.thoughtworks.xstream.io.xml.XppDriver.createReader(Unknown Source)
at com.thoughtworks.xstream.XStream.fromXML(Unknown Source)
at com.thoughtworks.xstream.XStream.fromXML(Unknown Source)
at org.picocontainer.defaults.XStreamSerialisationTestCase.testShouldBeAbleToSerialiseEmptyPico(XStreamSerialisationTestCase.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
So, it looks as if the XPP3 library is required. I would think that XStream would fall back to the DomDriver if XPP3 doesn't exist in the classpath.
Jake
BTW, this also affects Prevayler's use of XStream. We use new XStream() and when we do xstream.fromXML(Reader), we get the same exception as I originally reported for the Picocontainer project. Here's a partial stacktrace...
A snapshot using XStream's XML serialization will be taken every 20 seconds...
java.lang.IllegalArgumentException: XPP3 pull parser library not present. Specify another driver. For example: new XStream(new DomDriver())
at com.thoughtworks.xstream.io.xml.XppDriver.createReader(Unknown Source)
at com.thoughtworks.xstream.XStream.fromXML(Unknown Source)
at org.prevayler.implementation.snapshot.XStreamSnapshotManager.readSnapshot(XStreamSnapshotManager.java:98)
Jake