Ian Schneider created GEOT-4036:
-----------------------------------

             Summary: testFiltersByDate fails for at least postgis and sqlserver
                 Key: GEOT-4036
                 URL: https://jira.codehaus.org/browse/GEOT-4036
             Project: GeoTools
          Issue Type: Test
          Components: jdbc-postgis plugin, jdbc-sqlserver plugin
            Reporter: Ian Schneider
            Assignee: Justin Deoliveira


The tests fail (the superclass is JDBCDateTest) on the first assertion (though 
now that I look at it, the second assertion is the same...) - expected 2, got 1.

Looking into this further, the issue lies with the 
TemporalConverterFactory.timeMillisToDate. This method introduces a timezone 
offset (equivalent to default timezone offset) into the value and the resulting 
generated SQL uses the day earlier - at least in my timezone :)

It appears that some work done in this method is superfluous at best and most 
likely incorrect (at least in this code path).

The javadoc for java.sql.Date(long) constructor notes that the driver will 
truncate the insignificant fields and present the value as 00:00:00 GMT (so all 
of these acrobatics appear superfluous). When this code is removed and the 
milliseconds constructor is used directly (without any calendar acrobatics), 
the tests pass. Likewise, when the calendar GMT timezone is removed, the tests 
pass. Similarly, with the removal of the 'set' methods, but leaving the GMT 
calendar timezone in place, the tests pass. It appears that the set methods use 
the local timezone to compute a new date based upon GMT 00:00:00 (which in my 
case, would be the day before)

Looking at the various values present in this code path (as it stands):

(the date in the test case):
initial millis 1246168800000
offset 360 (in seconds)
date.toString Sun Jun 28 00:00:00 MDT 2009

(in the converter):
convert before : 1246168800000
convert after 1246147200000

The difference in the above is 21600000 (or 360 seconds - my local offset)

I'd guess that this was added in an attempt something else *work*...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to