You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Michele Vivoda (JIRA)" <ji...@apache.org> on 2014/11/22 23:14:12 UTC

[jira] [Commented] (JXPATH-172) JXPathContext#getPointer claims that null will be returned the the XPath expr does not point to a valid node

    [ https://issues.apache.org/jira/browse/JXPATH-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14222211#comment-14222211 ] 

Michele Vivoda commented on JXPATH-172:
---------------------------------------

Hi,
you are probably right in pointing this out, doc is not clear,  "pointer will be null" should be replaced with "pointer will have a null value".

Additionally the outcome of that method depends also on the setting setLenient(boolean), only when this is true a Pointer is returned for an invalid path, otherwise a JXPathNotFoundException is thrown.

An invalid path is a path that "matches no properties in the graph", this can only be checked by JXPath with beans (that have classes that say which are "valid" paths) but not with dynamic models (map or DomDocument...) where "any" path is valid.


> JXPathContext#getPointer claims that null will be returned the the XPath expr does not point to a valid node
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: JXPATH-172
>                 URL: https://issues.apache.org/jira/browse/JXPATH-172
>             Project: Commons JXPath
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Michael Osipov
>
> {quote}
> Traverses the xpath and returns a Pointer. A Pointer provides easy access to a property. If the xpath matches no properties in the graph, the pointer will be null.
> {quote}
> This is not true because not {{null}} is returned but {{NullPointer}}. This makes a tremendous difference.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)