You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Giacomo Guarguaglini (JIRA)" <ji...@apache.org> on 2014/08/25 18:14:00 UTC

[jira] [Created] (JXPATH-170) NullPointerException using org.apache.commons.jxpath.ri.model.dynamic.DynamicPointer

Giacomo Guarguaglini created JXPATH-170:
-------------------------------------------

             Summary: NullPointerException using org.apache.commons.jxpath.ri.model.dynamic.DynamicPointer
                 Key: JXPATH-170
                 URL: https://issues.apache.org/jira/browse/JXPATH-170
             Project: Commons JXPath
          Issue Type: Bug
    Affects Versions: 1.2 Final
            Reporter: Giacomo Guarguaglini
             Fix For: 1.4


Trying to use alternative xpath (for example "homeAddress | streetNumber") we get a NullPointerException in 
org.apache.commons.jxpath.ri.model.dynamic.DynamicPointer.hashCode
and
org.apache.commons.jxpath.ri.model.dynamic.DynamicPointer.equals
due to not checked null value for attribute name.

Original code:
public int hashCode() {
        return System.identityHashCode(bean) + name.hashCode();
    }
fixed code

 public int hashCode() {
        return System.identityHashCode(bean) + ((name != null) ? name.hashCode() : 0);
    }

In a similar way for equals method.



--
This message was sent by Atlassian JIRA
(v6.2#6252)