jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r762313 - /jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerialValue.java
Date Mon, 06 Apr 2009 12:39:15 GMT
Author: jukka
Date: Mon Apr  6 12:39:15 2009
New Revision: 762313

URL: http://svn.apache.org/viewvc?rev=762313&view=rev
Log:
JCRRMI-17: Multiple TCK test failures

Value.equals() also check that the value types are equal.

Improved hashCode() and toString() methods for values.

Modified:
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerialValue.java

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerialValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerialValue.java?rev=762313&r1=762312&r2=762313&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerialValue.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerialValue.java
Mon Apr  6 12:39:15 2009
@@ -20,6 +20,7 @@
 import java.io.Serializable;
 import java.util.Calendar;
 
+import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
@@ -200,6 +201,7 @@
     public boolean equals(Object object) {
         try {
             return (object instanceof Value)
+                && type == ((Value) object).getType()
                 && getString().equals(((Value) object).getString());
         } catch (RepositoryException e) {
             return false;
@@ -214,9 +216,9 @@
      */
     public int hashCode() {
         try {
-            return getString().hashCode();
+            return type + getString().hashCode();
         } catch (RepositoryException e) {
-            return 0;
+            return type;
         }
     }
 
@@ -229,7 +231,7 @@
         try {
             return getString();
         } catch (RepositoryException e) {
-            return super.toString();
+            return PropertyType.nameFromValue(type);
         }
     }
 



Mime
View raw message