There is a lingering bug in (at least) Sun's JDK 
that causes SimpleDateFormat to occasionaly throw a
StringIndexOutOfBoundsException instead of a 
ParseException.
<http://developer.java.sun.com/developer/bugParade/bugs/4212077.html>
(Requires a cookie; thanks, Sun)

Some rogue client out there is sending a malformed 
HttpDate for the 'If-Modified-Since' header (don't 
know which, that info was not logged) which triggers 
this bug on our servers.

I propose to follow the advice in the Sun bug report 
and catch this additional exception so that Tomcat 
might recover gracefully:

--- RequestUtil.java    2001/05/11 22:34:28     1.14.2.4
+++ RequestUtil.java    2001/05/20 22:36:41
@@ -572,17 +572,20 @@
        try {
             date = rfc1123Format.parse(dateString);
        } catch (ParseException e) { }
+          catch (StringIndexOutOfBoundsException e) { }

         if( date==null)
            try {
                date = rfc1036Format.parse(dateString);
            } catch (ParseException e) { }
+              catch (StringIndexOutOfBoundsException e) { }

         if( date==null)
            try {
                date = asctimeFormat.parse(dateString);
            } catch (ParseException pe) {
            }
+              catch (StringIndexOutOfBoundsException e) { }

        if(date==null) {
            return -1;

Any objections to putting this in 3.2.2?

Keith

Reply via email to