Yeah, I went back and checked :-) ... If the server Date header does not
exist, getServerDate should default to the moment that the
InMemoryCachedResponse instance was created.
A quick fix is to add the following to ResponseBase
protected Date now = new Date();
And change... (also in ResponseBase)
public Date getServerDate() {
if (response_date == null) {
Date date = getDateHeader("Date");
response_date = (date != null) ? date : now;
}
return response_date;
}
- James
Garrett Rooney wrote:
> On 8/7/06, James M Snell <[EMAIL PROTECTED]> wrote:
>> The cached time is the instant that the resource entered the cached.
>> From what I can tell from RFC2616, that is supposed to be the value of
>> the Date header, if it exists, or the instant the response was received.
>> I believe I modified getServerDate() so that it will never return a
>> null, so the else return 0 below should actually never execute.
>
> Trust me, it does actually execute if there's literally no Date header
> returned from the server ;-)
>
> Without that patch, my embedded Jetty Servlet based tests were getting
> NullPointer exceptions.
>
>> However, I'll couch all of this is a blanket statement that I am not a
>> caching expert. For some of this, I'm learning as I go.
>
> Ditto ;-)
>
> -garrett
>