[
https://issues.apache.org/jira/browse/JXPATH-113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15025020#comment-15025020
]
Benedikt Ritter commented on JXPATH-113:
----------------------------------------
{code}
$ svn ci -m "JXPATH-113: NullPointerException in ChildContext when document
only contains an empty root node. Thanks to Michele Vivoda. This also fixes #1
from github."
Sending src/changes/changes.xml
Sending src/main/java/org/apache/commons/jxpath/ri/axes/ChildContext.java
Adding src/test/java/org/apache/commons/jxpath/issues/JXPath113Test.java
Transmitting file data ...
Committed revision 1716226.
{code}
Thank you!
> NullPointerException in ChildContext when document only contains an empty
> root node
> -----------------------------------------------------------------------------------
>
> 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.4
>
>
> In ChildContext I get a NullPointerException, the error appears in method
> prepare()
> {code:java}
> iterator = (startFromParentLocation ? parent.getParent() :
> parent).childIterator(nodeTest,
> reverse, startFromParentLocation ? parent : null);
> {code}
>
> should be changed in my opinion to
> {code:java}
> final NodePointer actualParent = startFromParentLocation ? parent.getParent()
> : parent;
> iterator = actualParent==null ? null :
> actualParent.childIterator(nodeTest,
> reverse, startFromParentLocation ? parent : null);
> {code}
> The tests triggering the error are testIssue172_CountFollowingSiblingNode and
> testIssue172_CountPrecedingSiblingNode
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)