[infinispan-issues] [JBoss JIRA] Created: (ISPN-713) Loss of precision in date comparison when If-Unmodified-Since header is used with GET requests

Manik Surtani (JIRA) jira-events at lists.jboss.org
Tue Oct 19 13:12:54 EDT 2010


Loss of precision in date comparison when If-Unmodified-Since header is used with GET requests
----------------------------------------------------------------------------------------------

                 Key: ISPN-713
                 URL: https://jira.jboss.org/browse/ISPN-713
             Project: Infinispan
          Issue Type: Bug
          Components: Cache Server
    Affects Versions: 4.1.0.Final, 4.0.0.Final
            Reporter: Manik Surtani
            Assignee: Manik Surtani
             Fix For: 4.2.0.BETA1, 4.2.0.Final


This is the test case that fails: 

PUT uri1 
GET uri1 
dateLast = Last-Modified header from last GET response 
GET uri1 (with header If-Unmodified-Since: dateLast) 
should get normal entity response, getting code 412(Precondition Failed) instead 
(the 412 should be returned when the date in If-Unmodified-Since is sooner than the stored value but not equal) 


The infinispan REST server uses org.jboss.resteasy.specimpl.RequestImpl to decide the preconditions 
the issue concerns the date comparation on line 156: if (date.getTime() >= lastModified.getTime()) 
_date_ - date that was obtained from the request header If-Unmodified-Since 
_lastModified_ - the lastmodified date that was stored in MIMECacheEntry 

the thing is that _lastModified_ contains also milliseconds whereas _date_ doesn't, it has them zeroed, because it's been just parsed from string. 
_lastModified_ contains the milliseconds because the way it's created in MIMECacheEntry constructor during PUT request ( System.currentTimeMillis() ) 

The milliseconds from the _lastModified_ in MIMECacheEntry should be discarded before the comparation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the infinispan-issues mailing list