You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Michael Bouschen (JIRA)" <ji...@apache.org> on 2007/10/25 17:03:51 UTC
[jira] Created: (JDO-547) api2
ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected
date format in different locales
api2 ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected date format in different locales
--------------------------------------------------------------------------------------------------------------
Key: JDO-547
URL: https://issues.apache.org/jira/browse/JDO-547
Project: JDO
Issue Type: Bug
Components: api2, api2-legacy
Affects Versions: JDO 2 maintenance release 1
Reporter: Michael Bouschen
Assignee: Michael Bouschen
Fix For: JDO 2 maintenance release 1
Method testStringNullDateConstructor of api2 test class ObjectIdentityTest uses a DateFormat instance obtained by DateFormat.getInstance(). This returns the default date/time formatter which is then used to parse a date in format "M/d/yy h:mm a".
This does not work in case the default date/time formatter uses a format different from "M/d/yy h:mm a", because of a different locale. E.g. the format for the German locale is "dd.MM.yy HH:mm". This leads to an exception when parsing the date string:
Testcase: testStringNullDateConstructor(javax.jdo.identity.ObjectIdentityTest): Caused an ERROR
Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
javax.jdo.JDOUserException: Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JDO-547) api2
ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected
date format in different locales
Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JDO-547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538010 ]
Craig Russell commented on JDO-547:
-----------------------------------
The code that is checked in assumes two things:
1. You can always execute DateFormat.getInstance() regardless of what your locale is.
2. DateFormat.getInstance() never throws an exception.
Comments?
> api2 ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected date format in different locales
> --------------------------------------------------------------------------------------------------------------
>
> Key: JDO-547
> URL: https://issues.apache.org/jira/browse/JDO-547
> Project: JDO
> Issue Type: Bug
> Components: api2, api2-legacy
> Affects Versions: JDO 2 maintenance release 1
> Reporter: Michael Bouschen
> Assignee: Michael Bouschen
> Fix For: JDO 2 maintenance release 1
>
>
> Method testStringNullDateConstructor of api2 test class ObjectIdentityTest uses a DateFormat instance obtained by DateFormat.getInstance(). This returns the default date/time formatter which is then used to parse a date in format "M/d/yy h:mm a".
> This does not work in case the default date/time formatter uses a format different from "M/d/yy h:mm a", because of a different locale. E.g. the format for the German locale is "dd.MM.yy HH:mm". This leads to an exception when parsing the date string:
> Testcase: testStringNullDateConstructor(javax.jdo.identity.ObjectIdentityTest): Caused an ERROR
> Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
> javax.jdo.JDOUserException: Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JDO-547) api2
ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected
date format in different locales
Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JDO-547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543430 ]
Craig Russell commented on JDO-547:
-----------------------------------
Looks good.
> api2 ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected date format in different locales
> --------------------------------------------------------------------------------------------------------------
>
> Key: JDO-547
> URL: https://issues.apache.org/jira/browse/JDO-547
> Project: JDO
> Issue Type: Bug
> Components: api2, api2-legacy
> Affects Versions: JDO 2 maintenance release 1
> Reporter: Michael Bouschen
> Assignee: Michael Bouschen
> Fix For: JDO 2 maintenance release 1
>
> Attachments: JDO-547.patch
>
>
> Method testStringNullDateConstructor of api2 test class ObjectIdentityTest uses a DateFormat instance obtained by DateFormat.getInstance(). This returns the default date/time formatter which is then used to parse a date in format "M/d/yy h:mm a".
> This does not work in case the default date/time formatter uses a format different from "M/d/yy h:mm a", because of a different locale. E.g. the format for the German locale is "dd.MM.yy HH:mm". This leads to an exception when parsing the date string:
> Testcase: testStringNullDateConstructor(javax.jdo.identity.ObjectIdentityTest): Caused an ERROR
> Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
> javax.jdo.JDOUserException: Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (JDO-547) api2
ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected
date format in different locales
Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JDO-547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Bouschen resolved JDO-547.
----------------------------------
Resolution: Fixed
Checked in the patch (see revision 596211).
> api2 ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected date format in different locales
> --------------------------------------------------------------------------------------------------------------
>
> Key: JDO-547
> URL: https://issues.apache.org/jira/browse/JDO-547
> Project: JDO
> Issue Type: Bug
> Components: api2, api2-legacy
> Affects Versions: JDO 2 maintenance release 1
> Reporter: Michael Bouschen
> Assignee: Michael Bouschen
> Fix For: JDO 2 maintenance release 1
>
> Attachments: JDO-547.patch
>
>
> Method testStringNullDateConstructor of api2 test class ObjectIdentityTest uses a DateFormat instance obtained by DateFormat.getInstance(). This returns the default date/time formatter which is then used to parse a date in format "M/d/yy h:mm a".
> This does not work in case the default date/time formatter uses a format different from "M/d/yy h:mm a", because of a different locale. E.g. the format for the German locale is "dd.MM.yy HH:mm". This leads to an exception when parsing the date string:
> Testcase: testStringNullDateConstructor(javax.jdo.identity.ObjectIdentityTest): Caused an ERROR
> Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
> javax.jdo.JDOUserException: Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JDO-547) api2
ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected
date format in different locales
Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JDO-547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Bouschen updated JDO-547:
---------------------------------
Attachment: JDO-547.patch
I propose to remove the test method testStringNullDateConstructor. In order to work in a locale other than the US locale we need to register a date formatter based on the US locale that is able to parse the specified date literal. This is already tested in method testStringDateConstructor.
Attached you find a patch removing method testStringNullDateConstructor from ObjectIdentityTest in api2 and api2-legacy.
> api2 ObjectIdentityTest.testStringNullDateConstructor fails due to unexpected date format in different locales
> --------------------------------------------------------------------------------------------------------------
>
> Key: JDO-547
> URL: https://issues.apache.org/jira/browse/JDO-547
> Project: JDO
> Issue Type: Bug
> Components: api2, api2-legacy
> Affects Versions: JDO 2 maintenance release 1
> Reporter: Michael Bouschen
> Assignee: Michael Bouschen
> Fix For: JDO 2 maintenance release 1
>
> Attachments: JDO-547.patch
>
>
> Method testStringNullDateConstructor of api2 test class ObjectIdentityTest uses a DateFormat instance obtained by DateFormat.getInstance(). This returns the default date/time formatter which is then used to parse a date in format "M/d/yy h:mm a".
> This does not work in case the default date/time formatter uses a format different from "M/d/yy h:mm a", because of a different locale. E.g. the format for the German locale is "dd.MM.yy HH:mm". This leads to an exception when parsing the date string:
> Testcase: testStringNullDateConstructor(javax.jdo.identity.ObjectIdentityTest): Caused an ERROR
> Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
> javax.jdo.JDOUserException: Error parsing Date string "10/9/2007 4:26 PM" at position 2 using date format "dd.MM.yy HH:mm".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.