Apache JDO Project - Re: svn commit: r209692 - in /incubator/jdo/trunk/api20: src/java/javax/jdo/

This is Interesting: Free IT Magazines  
Home > Archive > Apache JDO Project > July 2005 > Re: svn commit: r209692 - in /incubator/jdo/trunk/api20: src/java/javax/jdo/





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: svn commit: r209692 - in /incubator/jdo/trunk/api20: src/java/javax/jdo/
Michael Bouschen

2005-07-08, 7:45 am

Hi Michael,

as Andy pointed out, this is a date parsing error. You find the error
stack trace in TEST-javax.jdo.identity.ObjectIdentityTest.txt under
target/test-reports.

The JDOImplHelper parses Date string using a DateFormat instance
retrieved by calling DateFormat.getDateTimeInstance. The no-arg version
of getDateTimeInstance uses the default locale which is different for
Craig and you (Locale.US vs. Locale.GERMANY). The ObjectIdentityTest
specifies date strings in US format: 'Jan 01, 1970 00:00:00 AM' which
does not parse with a DateFormat using the German locale.

A possible solution could be using the US locale when creating the
DateFormat. Replace dateFormat definition on line 94 of JDOImplHelper
with the following line:
static DateFormat dateFormat = DateFormat.getDateTimeInstance(
DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.US);
Then all the test cases pass. The downside is that this hard codes the
US locale in the JDOImplHelper code. Maybe the JDOImplHelper could use
the US locale as the default, but provide a way to override this. It
already provides a method registerDateFormat to override the
dateFormatPattern, but this needs to be in sync with the locale of the
dateFormat instance.

Regards Michael

>
>You mean the failed test ?
>This is the error. Looks like some date parsing needs a fix in JDOImplHelper.
>
>javax.jdo.JDOUserException: Error parsing Date string "Jan 01, 1970 00:00:00
>AM" at position 0 using date format "MMM d, yyyy hh:mm:ss a".
>at javax.jdo.spi.JDOImplHelper$3.construct(JDOImplHelper.java:580)
> at javax.jdo.spi.JDOImplHelper.construct(JDOImplHelper.java:610)
> at javax.jdo.identity.ObjectIdentity.<init>(ObjectIdentity.java:86)
> at
>javax.jdo.identity.ObjectIdentityTest. testStringDateConstructor(ObjectIdentity
Test.java:202)
>
>
>HTH
>
>



--
Michael Bouschen Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de http://www.tech.spree.de/
Tel.:++49/30/235 520-33 Buelowstr. 66
Fax.:++49/30/2175 2012 D-10783 Berlin


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com