You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Andy Yeung (JIRA)" <ji...@apache.org> on 2006/10/13 06:10:36 UTC

[jira] Created: (CONFIGURATION-230) XPathExpressionEngine nodeKey method create a wrong key for attribute node

XPathExpressionEngine nodeKey method create a wrong key for attribute node
--------------------------------------------------------------------------

                 Key: CONFIGURATION-230
                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-230
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.3 Final
         Environment: Any
            Reporter: Andy Yeung


In org.apache.commons.configuration.tree.xpath.XPathExpressionEngine line 178

            if (node.isAttribute())
            {
                buf.append(ATTR_DELIMITER);
            }

should be changed to 

            if (node.isAttribute()) {
	buf.append(NODE_PATH_DELIMITERS);
            }

Using ATTR_DELIMITER will create key like element@attribute rather than element/@attribute and make config reload fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (CONFIGURATION-230) XPathExpressionEngine nodeKey method create a wrong key for attribute node

Posted by "Andy Yeung (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CONFIGURATION-230?page=all ]

Andy Yeung updated CONFIGURATION-230:
-------------------------------------

    Attachment: ConfigTest.java

Here is the test case attached. and the console output is
You can see that  exception is thrown during reload and the XML Configuration didn't get updated after the content  is changed.

com.cherrypicks.augur.message.impl.EchoStringMessage
org.apache.commons.jxpath.JXPathException: Invalid XPath: 'messagehandler/message@type'. Syntax error after: 'messagehandler/m'
	at org.apache.commons.jxpath.ri.Parser.parseExpression(Parser.java:60)
	at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.compileExpression(JXPathContextReferenceImpl.java:218)
	at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.iteratePointers(JXPathContextReferenceImpl.java:529)
	at org.apache.commons.jxpath.JXPathContext.selectNodes(JXPathContext.java:654)
	at org.apache.commons.configuration.tree.xpath.XPathExpressionEngine.query(XPathExpressionEngine.java:135)
	at org.apache.commons.configuration.HierarchicalConfiguration.fetchNodeList(HierarchicalConfiguration.java:694)
	at org.apache.commons.configuration.HierarchicalConfiguration.getProperty(HierarchicalConfiguration.java:264)
	at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.getProperty(AbstractHierarchicalFileConfiguration.java:292)
	at org.apache.commons.configuration.HierarchicalConfiguration.containsKey(HierarchicalConfiguration.java:514)
	at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.containsKey(AbstractHierarchicalFileConfiguration.java:280)
	at org.apache.commons.configuration.AbstractConfiguration.clear(AbstractConfiguration.java:381)
	at org.apache.commons.configuration.XMLConfiguration.clear(XMLConfiguration.java:344)
	at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration$FileConfigurationDelegate.clear(AbstractHierarchicalFileConfiguration.java:385)
	at org.apache.commons.configuration.AbstractFileConfiguration.reload(AbstractFileConfiguration.java:777)
	at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.reload(AbstractHierarchicalFileConfiguration.java:259)
	at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.getProperty(AbstractHierarchicalFileConfiguration.java:291)
	at org.apache.commons.configuration.AbstractConfiguration.resolveContainerStore(AbstractConfiguration.java:1048)
	at org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:940)
	at org.apache.commons.configuration.AbstractConfiguration.getString(AbstractConfiguration.java:920)
	at com.cherrypicks.common.config.ConfigTest.testReload(ConfigTest.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	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:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
	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)
com.cherrypicks.augur.message.impl.EchoStringMessage


> XPathExpressionEngine nodeKey method create a wrong key for attribute node
> --------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-230
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-230
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3 Final
>         Environment: Any
>            Reporter: Andy Yeung
>         Attachments: ConfigTest.java
>
>
> In org.apache.commons.configuration.tree.xpath.XPathExpressionEngine line 178
>             if (node.isAttribute())
>             {
>                 buf.append(ATTR_DELIMITER);
>             }
> should be changed to 
>             if (node.isAttribute()) {
> 	buf.append(NODE_PATH_DELIMITERS);
>             }
> Using ATTR_DELIMITER will create key like element@attribute rather than element/@attribute and make config reload fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-230) XPathExpressionEngine nodeKey method create a wrong key for attribute node

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-230?page=comments#action_12442299 ] 
            
Oliver Heger commented on CONFIGURATION-230:
--------------------------------------------

Do you have a code snippet (or even better a unit test) that demonstrates the problem? We need to expose the bug first, so that we can verify that it is resolved by the fix.
Thanks.

> XPathExpressionEngine nodeKey method create a wrong key for attribute node
> --------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-230
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-230
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3 Final
>         Environment: Any
>            Reporter: Andy Yeung
>
> In org.apache.commons.configuration.tree.xpath.XPathExpressionEngine line 178
>             if (node.isAttribute())
>             {
>                 buf.append(ATTR_DELIMITER);
>             }
> should be changed to 
>             if (node.isAttribute()) {
> 	buf.append(NODE_PATH_DELIMITERS);
>             }
> Using ATTR_DELIMITER will create key like element@attribute rather than element/@attribute and make config reload fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (CONFIGURATION-230) XPathExpressionEngine nodeKey method create a wrong key for attribute node

Posted by "Andy Yeung (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CONFIGURATION-230?page=all ]

Andy Yeung updated CONFIGURATION-230:
-------------------------------------

    Attachment: ConfigTest.java

Oh, I have modified the testcase so that the test didn't pass when the xml is not reloaded.

> XPathExpressionEngine nodeKey method create a wrong key for attribute node
> --------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-230
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-230
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3 Final
>         Environment: Any
>            Reporter: Andy Yeung
>         Attachments: ConfigTest.java, ConfigTest.java
>
>
> In org.apache.commons.configuration.tree.xpath.XPathExpressionEngine line 178
>             if (node.isAttribute())
>             {
>                 buf.append(ATTR_DELIMITER);
>             }
> should be changed to 
>             if (node.isAttribute()) {
> 	buf.append(NODE_PATH_DELIMITERS);
>             }
> Using ATTR_DELIMITER will create key like element@attribute rather than element/@attribute and make config reload fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org