You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Brian de Alwis (JIRA)" <ji...@apache.org> on 2010/01/16 00:48:54 UTC

[jira] Created: (CONFIGURATION-405) Using load(InputStream) on a new XMLPropertyListConfiguration results in a thrown ConfigurationException

Using load(InputStream) on a new XMLPropertyListConfiguration results in a thrown ConfigurationException
--------------------------------------------------------------------------------------------------------

                 Key: CONFIGURATION-405
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-405
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.6
         Environment: MacOS X 6.2, JavaSE 1.6
            Reporter: Brian de Alwis


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


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CONFIGURATION-405) Using load(InputStream) on a new XMLPropertyListConfiguration results in a thrown ConfigurationException

Posted by "Brian de Alwis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian de Alwis updated CONFIGURATION-405:
-----------------------------------------

    Attachment: TestXMLPlists.java

Simple test case.

> Using load(InputStream) on a new XMLPropertyListConfiguration results in a thrown ConfigurationException
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-405
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-405
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6
>         Environment: MacOS X 6.2, JavaSE 1.6
>            Reporter: Brian de Alwis
>         Attachments: TestXMLPlists.java
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CONFIGURATION-405) Using load(InputStream) on a new XMLPropertyListConfiguration results in a thrown ConfigurationException

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804229#action_12804229 ] 

Oliver Heger commented on CONFIGURATION-405:
--------------------------------------------

The problem obviously lies deeper: Actually all plist configuration files that do not have an outer _dict_ element cause this exception.

> Using load(InputStream) on a new XMLPropertyListConfiguration results in a thrown ConfigurationException
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-405
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-405
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6
>         Environment: MacOS X 6.2, JavaSE 1.6
>            Reporter: Brian de Alwis
>            Assignee: Oliver Heger
>         Attachments: TestXMLPlists.java
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CONFIGURATION-405) Using load(InputStream) on a new XMLPropertyListConfiguration results in a thrown ConfigurationException

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger resolved CONFIGURATION-405.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.7

A fix was applied in subversion revision 902600. Thank you for spotting this.

> Using load(InputStream) on a new XMLPropertyListConfiguration results in a thrown ConfigurationException
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-405
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-405
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6
>         Environment: MacOS X 6.2, JavaSE 1.6
>            Reporter: Brian de Alwis
>            Assignee: Oliver Heger
>             Fix For: 1.7
>
>         Attachments: TestXMLPlists.java
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.