[ 
https://issues.apache.org/activemq/browse/AMQ-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Giovani Seben updated AMQ-2179:
-------------------------------

    Attachment: AMQ-2179.patch

Patch for the issue is attached.

Note that, the selectNodeIterator check is still attempted to maintain previous 
functionality. In the case of selecting an empty element selectNodeIterator 
would return true while eval() returns false. 

The fix adds more flexibility to the XPath expressions that can be used and 
SelectorTest.java was update to to test a wider range of comparisons.

> XPath selector fails to select messages correctly when the expression 
> evaluates to 'true' 
> ------------------------------------------------------------------------------------------
>
>                 Key: AMQ-2179
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2179
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Selector
>    Affects Versions: 5.0.0, 5.1.0, 5.2.0
>         Environment: Windows XP
>            Reporter: Giovani Seben
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2179.patch
>
>
> Currently the XalanXPathEvaluator class will return 'true' or 'false' based 
> on the existence of a node in the XML document that matches the XPath 
> expression. However, XPath expressions themselves can return values of true 
> or false based on a comparison criteria. 
> For example, for an input message:
> {code}
> <root>
>   <a key='first' num='1'/>
>   <b key='second' num='2'>b</b>
> </root>
> {code}
> A consumer using an XPath selector with an expression such as: 
> {code}
> XPATH '/root/b="b"'
> {code}
> should successfully select and consume the message above. 
> The evaluator today would attempt to retrieve a XML node with that 
> expression, but it would fail and return false since the returned value of 
> the expression is a Boolean.
> The XPath Selector should be able to handle Boolean expressions.

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

Reply via email to