commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1133160 - /commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java
Date Tue, 07 Jun 2011 20:56:37 GMT
Author: mbenson
Date: Tue Jun  7 20:56:37 2011
New Revision: 1133160

URL: http://svn.apache.org/viewvc?rev=1133160&view=rev
Log:
[JXPATH-142] avoid NullPointerExceptions in DynamicPointer w/ null name

Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java?rev=1133160&r1=1133159&r2=1133160&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java
Tue Jun  7 20:56:37 2011
@@ -123,7 +123,7 @@ public class DynamicPointer extends Prop
     }
 
     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 class DynamicPointer extends Prop
         }
 
         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);
     }
 }



Mime
View raw message