Skip to content
Permalink
Browse files
[JXPATH-142] avoid NullPointerExceptions in DynamicPointer w/ null name
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/jxpath/trunk@1133160 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mbenson committed Jun 7, 2011
1 parent 515ed3d commit 74c38b4e3c6eb051c03fb9994be33e2b65499c01
Showing 1 changed file with 5 additions and 2 deletions.
@@ -123,7 +123,7 @@ public String asPath() {
}

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

public boolean equals(Object object) {
@@ -136,6 +136,9 @@ public boolean equals(Object object) {
}

DynamicPointer other = (DynamicPointer) object;
return bean == other.bean && name.equals(other.name);
if (bean != other.bean) {
return false;
}
return name == other.name || name != null && name.equals(other.name);
}
}

0 comments on commit 74c38b4

Please sign in to comment.