jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r467674 - /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/value/DateValue.java
Date Wed, 25 Oct 2006 14:59:16 GMT
Author: stefan
Date: Wed Oct 25 07:59:16 2006
New Revision: 467674

URL: http://svn.apache.org/viewvc?view=rev&rev=467674
Log:
JCR-598: DateValue.equals() relies on Calendar.equals()

Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/value/DateValue.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/value/DateValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/value/DateValue.java?view=diff&rev=467674&r1=467673&r2=467674
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/value/DateValue.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/value/DateValue.java Wed
Oct 25 07:59:16 2006
@@ -72,6 +72,15 @@
      * The result is <code>true</code> if and only if the argument is not
      * <code>null</code> and is a <code>DateValue</code> object that
      * represents the same value as this object.
+     * <p>
+     * The value comparison is performed using the ISO 8601 string
+     * representation of the dates, since the native Calendar.equals()
+     * method may produce false negatives (see JSR-598).
+     * <p>
+     * Note that the comparison still returns false when comparing the
+     * same time in different time zones, but that seems to be the intent
+     * of JSR 170. Compare the Value.getDate().getTime() values if you need
+     * an exact time comparison in UTC. 
      *
      * @param obj the reference object with which to compare.
      * @return <code>true</code> if this object is the same as the obj
@@ -86,7 +95,7 @@
             if (date == other.date) {
                 return true;
             } else if (date != null && other.date != null) {
-                return date.equals(other.date);
+                return ISO8601.format(date).equals(ISO8601.format(other.date));
             }
         }
         return false;



Mime
View raw message