Here's that bug again...
----- Original Message -----
From: "Geoff Soutter" <[EMAIL PROTECTED]>
To: "JRun Talk" <[EMAIL PROTECTED]>
Cc: "Julian Conway" <[EMAIL PROTECTED]>; "Doug"
<[EMAIL PROTECTED]>
Sent: Monday, July 31, 2000 6:53 PM
Subject: [BUG] Request.getDateHeader() / HttpServlet.service() throws
NullPointerException for If-Modified-Since
> Hi there,
>
> I'm getting some pretty unfortunate behaviour from JRun 3.0.
>
> I've written my own basic FileServlet for serving files direct from the
file
> system. It makes the call:
>
> lIfModifiedSince = aRequest.getDateHeader( "If-Modified-Since" );
>
> to get the value of the If-Modified-Since header to tell if you can tell
the
> client that the page hasn't changed. Now, if you call it (for the second
> time, when it's trying to cache) from Netscape 4.x or IE5.0, this code
> generates a NullPointerException, eg
>
> java.lang.NullPointerException
> at
> allaire.jrun.ServletConnection.getDateHeader(ServletConnection.java:281)
> at mypackage.FileServlet.doGet(FileServlet.java:80)
>
> I put some debugging code in to print out the value of the Header
extracted
> as a string using Request.getHeader( "If-Modified-Since") and I get:
>
> 'Thu, 27 Jul 2000 10:08:15 GMT; length=125'
>
> Seems the length= value is a non-standard extra that not in the HTTP spec
> but both IE and NS add it in...
>
> Even worse, this behaviour will also presumably break _any_ servlet that
> overrides getLastModified(), because java.servlet.HttpServlet.service()
also
> calls getDateHeader("If-Last-Modified") if your implementation of
> getLastModified doesn't return -1. My FileServlet does it all itself, so I
> didn't see this problem immediately
>
> Now, the funny thing is that I don't get any exceptions or problems when I
> run this under Tomcat. It appears it's code ignores the end of line. So
> presumably they've already dealt with this problem...
>
> I could code around it manually, but then I need to try and deciper the at
> least three different date formats that the HTTP spec specifies, and given
> this only occurs under JRun, i'd rather not...
>
> Note, I managed to find some discussion about this on the official HTTP
> mailing list archive, and it seems they think one ought to ignore trailing
> stuff in this case ... see
> http://www.ics.uci.edu/pub/ietf/http/hypermail/1996q2/0817.html
>
> cheers
>
> Geoff
>
>
> --------------------------------------------------------------------------
----
> Archives: http://www.egroups.com/group/jrun-interest/
> Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
> or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.
>
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.