[jira] Created: (JXPATH-113) NullPointerException in ChildContext

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (JXPATH-113) NullPointerException in ChildContext

JIRA jira@apache.org
NullPointerException in ChildContext
------------------------------------

                 Key: JXPATH-113
                 URL: https://issues.apache.org/jira/browse/JXPATH-113
             Project: Commons JXPath
          Issue Type: Bug
            Reporter: Michele Vivoda
            Priority: Minor


In ChildContext I get a NullPointerException, the error appears in method prepare()

    iterator = (startFromParentLocation ? parent.getParent() : parent).childIterator(nodeTest,
                reverse, startFromParentLocation ? parent : null);
   
should be changed in my opinion to

final NodePointer actualParent = startFromParentLocation ? parent.getParent() : parent;
        iterator = actualParent==null ? null : actualParent.childIterator(nodeTest,
                reverse, startFromParentLocation ? parent : null);

The tests triggering the error are testIssue172_CountFollowingSiblingNode and testIssue172_CountPrecedingSiblingNode

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (JXPATH-113) NullPointerException in ChildContext

JIRA jira@apache.org

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

Michele Vivoda commented on JXPATH-113:
---------------------------------------

Test case:

XML

<xml/>

XPATH

//following-sibling::node()

> NullPointerException in ChildContext
> ------------------------------------
>
>                 Key: JXPATH-113
>                 URL: https://issues.apache.org/jira/browse/JXPATH-113
>             Project: Commons JXPath
>          Issue Type: Bug
>            Reporter: Michele Vivoda
>            Priority: Minor
>
> In ChildContext I get a NullPointerException, the error appears in method prepare()
>     iterator = (startFromParentLocation ? parent.getParent() : parent).childIterator(nodeTest,
>                 reverse, startFromParentLocation ? parent : null);
>    
> should be changed in my opinion to
> final NodePointer actualParent = startFromParentLocation ? parent.getParent() : parent;
>         iterator = actualParent==null ? null : actualParent.childIterator(nodeTest,
>                 reverse, startFromParentLocation ? parent : null);
> The tests triggering the error are testIssue172_CountFollowingSiblingNode and testIssue172_CountPrecedingSiblingNode

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

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (JXPATH-113) NullPointerException in ChildContext

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Matt Benson resolved JXPATH-113.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3

This one was obvious enough that just a claim of an NPE was good enough.  I've committed essentially the fix you've suggested, rev 617893.  Thanks!

> NullPointerException in ChildContext
> ------------------------------------
>
>                 Key: JXPATH-113
>                 URL: https://issues.apache.org/jira/browse/JXPATH-113
>             Project: Commons JXPath
>          Issue Type: Bug
>            Reporter: Michele Vivoda
>            Priority: Minor
>             Fix For: 1.3
>
>
> In ChildContext I get a NullPointerException, the error appears in method prepare()
>     iterator = (startFromParentLocation ? parent.getParent() : parent).childIterator(nodeTest,
>                 reverse, startFromParentLocation ? parent : null);
>    
> should be changed in my opinion to
> final NodePointer actualParent = startFromParentLocation ? parent.getParent() : parent;
>         iterator = actualParent==null ? null : actualParent.childIterator(nodeTest,
>                 reverse, startFromParentLocation ? parent : null);
> The tests triggering the error are testIssue172_CountFollowingSiblingNode and testIssue172_CountPrecedingSiblingNode

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