|I hope this counts as a subtle bug and can help those encountering something similar.
I'm reading in a bunch of data from files. Basically a datetime (dts) and a float value. Because we're talking about 1.3 million records which I read in with several files, create a list of insert queries and execute them by 100 at the time. Everything worked except for some batches.
So looking at the errors, it says it runs into a unique constraint (dts is unique). Fine, what value was double then? none.
is my state of mind by now. So I continue looking and print out the failed batches and sure enough there are double values in there. Checking the corresponding files : no doubles. But what does my little eye spy? double dts values start with 3 'o clock and only at the end of march! Daylightsaving (DTS).
The bug: I use java's GregorianCalendar and if you don't specify the timezone it will convert the 2:00 until 3:00 to 1 hour +. so 2:30 becomes 3:30 etc... What is strange though, is that there is no warning, no exceptions nothing. Just implicit conversion.
Perhaps it is my misunderstanding of the object, but if you encounter something similar, you just might want to check in this direction.
PS: I considered this forum to be the replacement of subtle bugs.
The solution is to set the timezone to UTC.
If you use de SimpleDateFormat class to format the dates to string. This also has a timezome, which you also need to set to UTC to avoid having the date converted.
modified 11-Jul-12 2:45am.