db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <mbo.t...@spree.de>
Subject Re: svn commit: r209692 - in /incubator/jdo/trunk/api20: src/java/javax/jdo/ src/java/javax/jdo/identity/ src/java/javax/jdo/spi/ test/java/javax/jdo/identity/
Date Fri, 08 Jul 2005 13:13:40 GMT
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 

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

>>I have updated my api20 workspace today and called "maven -o rebuild".
>>The ObjectIdentityTest prints an error (see below). I'm not sure, why I
>>do not see the error stacktrace.
>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 

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			

View raw message