Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6
-
None
-
None
-
MacOS X 6.2, JavaSE 1.6
Description
I'm trying to use XMLPropertyListConfiguration to load a property-list from a byte array. My code looks like:
XMLPropertyListConfiguration plist = new XMLPropertyListConfiguration();
// plist.setRootNode(new PListNode()); // HACK to work around internal cast exception
plist.load(new ByteArrayInputStream(bytes));
This causes a ConfigurationException caused by a class exception (reproduced below). The exception can be avoided by uncommenting the second line.
org.apache.commons.configuration.ConfigurationException: Unable to parse the configuration file
at org.apache.commons.configuration.plist.XMLPropertyListConfiguration.load(XMLPropertyListConfiguration.java:250)
at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration$FileConfigurationDelegate.load(AbstractHierarchicalFileConfiguration.java:449)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:358)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:324)
at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.load(AbstractHierarchicalFileConfiguration.java:184)
at testcc.TestCC.main(TestCC.java:29)
Caused by: java.lang.ClassCastException: org.apache.commons.configuration.HierarchicalConfiguration$Node cannot be cast to org.apache.commons.configuration.plist.XMLPropertyListConfiguration$PListNode
at org.apache.commons.configuration.plist.XMLPropertyListConfiguration$XMLPropertyListHandler.endElement(XMLPropertyListConfiguration.java:534)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endNamespaceScope(XMLDTDValidator.java:2077)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2028)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.commons.configuration.plist.XMLPropertyListConfiguration.load(XMLPropertyListConfiguration.java:246)
... 5 more