When updating the Usertype project (http://usertype.sourceforge.net/) to dbunit 2.4.8, I have found a defect in handling of timestamps.
The change in revision 1131 (bug 2921131) introduces a defect because the handling of zero padding in the millisecond field
differs between SimpleDateFormat and the JDBC escape format for Timestamp.
in SimpleDateFormat .5 gives 005 millis
in JDBC escape format .5 gives 500 millis
In addition, the change in this version removes support for nanosecond precision from the timestamp.
I have included a revised patch which I believe addresses the above problems (including additions to the tests that demonstrate it)
whilst supporting the improvement the original patch aimed to provide (i.e. zone support).
Regards Chris
Fixes to timestamp conversion and unit test case
Your fix has been accepted and committed to the project repository.
Thank you!
This bugfix causes regressions in our test-suites.
IMHO, the provided fix is flawed as it does not take into account that java.sql.Timestamp.parse(String) is always local-time.
In consequence, the following comparisons fail for me (Europe/Berlin, GMT+1, JDK 6)
My proposed fix of the previous fix (without saying that this is the way it should be implemented):
Let's say you are GMT+1 and you are parsing (just the time-component for brevity): "12:00 +0600". With java.sql.Timestamp.valueOf("12:00") you will get "12:00 +0100". To transpose to local-time you have to calculate "12:00 +0100" -0600 +0100 = "07:00 +0100" (and "06:00 +0000")