[jbosscache-issues] [JBoss JIRA] Updated: (JBCACHE-1562) CacheConfigsXmlParser can't parse a valid document
Brian Stansberry (JIRA)
jira-events at lists.jboss.org
Fri Dec 18 12:31:31 EST 2009
[ https://jira.jboss.org/jira/browse/JBCACHE-1562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brian Stansberry updated JBCACHE-1562:
--------------------------------------
Summary: CacheConfigsXmlParser can't parse a valid document (was: CacheConfigsXmlParsert can't parse a valid document)
> CacheConfigsXmlParser can't parse a valid document
> --------------------------------------------------
>
> Key: JBCACHE-1562
> URL: https://jira.jboss.org/jira/browse/JBCACHE-1562
> Project: JBoss Cache
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 3.2.1.GA
> Reporter: Brian Stansberry
> Assignee: Manik Surtani
>
> The logic in CacheConfigsXmlParser for distinguishing a legacy config from one using the 3.x schema ends up treating a 3.x config file as legacy. Result is you end up with a default Configuration object!
> public Map<String, Configuration> parseConfigs(InputStream stream, String fileName) throws CloneNotSupportedException
> {
> // loop through all elements in XML.
> Element root = getDocumentRoot(stream);
> NodeList list = root.getElementsByTagName(CONFIG_ROOT);
> if (list == null || list.getLength() == 0)
> {
> // try looking for a QUALIFIED_CONFIG_ROOT
> list = root.getElementsByTagName(QUALIFIED_CONFIG_ROOT);
> if (list == null || list.getLength() == 0)
> throw new ConfigurationException("Can't find " + CONFIG_ROOT + " or " + QUALIFIED_CONFIG_ROOT + " tag");
> }
> Map<String, Configuration> result = new HashMap<String, Configuration>();
> for (int i = 0; i < list.getLength(); i++)
> {
> Node node = list.item(i);
> if (node.getNodeType() != Node.ELEMENT_NODE)
> {
> continue;
> }
> Element element = (Element) node;
> String name = element.getAttribute(CONFIG_NAME);
> if (name == null || name.trim().length() == 0)
> throw new ConfigurationException("Element " + element + " has no name attribute");
> XmlConfigurationParser parser = new XmlConfigurationParser();
> Configuration c;
> if (parser.isValidElementRoot(element))
> {
> .... parse it
> } else .... use legacy parser
> Problem is in XmlConfigurationParsert.isValidElementRoot()
> public boolean isValidElementRoot(Element element)
> {
> // simply test for the "jbosscache" element.
> NodeList elements = element.getElementsByTagName("jbosscache");
> return elements != null && elements.getLength() > 0;
> }
> <registry:cache-config/> or <cache-config/> fail that test.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbosscache-issues
mailing list