remm 2002/06/13 20:19:43 Modified: catalina/src/share/org/apache/catalina/servlets DefaultServlet.java Log: - Add try/catch for IAE. - Patch submitted by James Carman <james at carmanconsulting.com> Revision Changes Path 1.57 +32 -27 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java Index: DefaultServlet.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- DefaultServlet.java 13 Jun 2002 22:34:42 -0000 1.56 +++ DefaultServlet.java 14 Jun 2002 03:19:43 -0000 1.57 @@ -1607,20 +1607,23 @@ HttpServletResponse response, ResourceInfo resourceInfo) throws IOException { - - long headerValue = request.getDateHeader("If-Modified-Since"); - long lastModified = resourceInfo.date; - if (headerValue != -1) { - - // If an If-None-Match header has been specified, if modified since - // is ignored. - if ((request.getHeader("If-None-Match") == null) - && (lastModified <= headerValue + 1000)) { - // The entity has not been modified since the date - // specified by the client. This is not an error case. - response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); - return false; + try { + long headerValue = request.getDateHeader("If-Modified-Since"); + long lastModified = resourceInfo.date; + if (headerValue != -1) { + + // If an If-None-Match header has been specified, if modified since + // is ignored. + if ((request.getHeader("If-None-Match") == null) + && (lastModified <= headerValue + 1000)) { + // The entity has not been modified since the date + // specified by the client. This is not an error case. + response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); + return false; + } } + } catch(IllegalArgumentException illegalArgument) { + return false; } return true; @@ -1699,17 +1702,19 @@ HttpServletResponse response, ResourceInfo resourceInfo) throws IOException { - - long lastModified = resourceInfo.date; - long headerValue = request.getDateHeader("If-Unmodified-Since"); - if (headerValue != -1) { - if ( lastModified > headerValue ) { - // The entity has not been modified since the date - // specified by the client. This is not an error case. - response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED); - return false; + try { + long lastModified = resourceInfo.date; + long headerValue = request.getDateHeader("If-Unmodified-Since"); + if (headerValue != -1) { + if ( lastModified > headerValue ) { + // The entity has not been modified since the date + // specified by the client. This is not an error case. + response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED); + return false; + } } - + } catch(IllegalArgumentException illegalArgument) { + return false; } return true;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>