[dna-issues] [JBoss JIRA] Updated: (DNA-491) JodaDateTime Is Using Overly-Strict Equality Test
Brian Carothers (JIRA)
jira-events at lists.jboss.org
Mon Jul 13 11:02:29 EDT 2009
[ https://jira.jboss.org/jira/browse/DNA-491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brian Carothers updated DNA-491:
--------------------------------
Attachment: DNA-491.patch
Attached patch that swaps the semantics of DateTime.isSameAs and DateTime.equals to be semantically consistent with the JCR expectation for equality of date times (that they represent the same logical instant in time).
> JodaDateTime Is Using Overly-Strict Equality Test
> -------------------------------------------------
>
> Key: DNA-491
> URL: https://jira.jboss.org/jira/browse/DNA-491
> Project: DNA
> Issue Type: Bug
> Affects Versions: 0.5
> Reporter: Brian Carothers
> Attachments: DNA-491.patch
>
>
> The JodaDateTime class, the default DateTime implementation for DNA, uses JODA DateTimes internally to represent instants in time in a time zone-neutral, machine portable fashion. By default, the equals method for JodaDateTime is using the DateTime.equals(Object) method[1]. This method checks that both objects represent equivalent logical instants AND have the exact same time zones AND are based on the same Chronology[2]. This implies that a date time representing 2:00 PM EST would not be ".equals" to another date time representing 1:00 PM CST on the same date, even though both represent the same logical instant. Additionally, DNA doesn't specify chronologies, leaving JODA to infer the chronology based on the date source.
> I recommend that we shift from using DateTime.equals(Object) to DateTime.isEqual(ReadableInstant)[3] internally to avoid these problems. This issue keeps the JPA connector from properly storing/reloading date properties on the TCK test.
> [1] - http://joda-time.sourceforge.net/api-release/org/joda/time/base/AbstractInstant.html#equals(java.lang.Object)
> [2] - JODA Chronologies are basically types of calendar like ISO8660, Gregorian/Julian, etc.
> [3] - http://joda-time.sourceforge.net/api-release/org/joda/time/base/AbstractInstant.html#isEqual(org.joda.time.ReadableInstant)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the dna-issues
mailing list