kinman 01/12/11 17:28:39 Modified: jasper/src/share/org/apache/jasper/compiler Tag: tomcat_40_branch JspReader.java jasper/src/share/org/apache/jasper/runtime Tag: tomcat_40_branch PageContextImpl.java Log: PR: 5345 - Ported the fix from the head branch. Revision Changes Path No revision No revision 1.6.2.1 +8 -1 jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspReader.java Index: JspReader.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspReader.java,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -r1.6 -r1.6.2.1 --- JspReader.java 2001/06/02 18:44:45 1.6 +++ JspReader.java 2001/12/12 01:28:39 1.6.2.1 @@ -332,7 +332,14 @@ */ public boolean hasMoreInput() throws ParseException { - if (current.cursor >= current.stream.length) { + // An extra '\n' seems to be inserted when there is none at end of + // a file. Not only is this useless, but it causes problems when + // none is expected (e.g. after response.sendRedirect() ). + + if (current.cursor >= current.stream.length || + ((current.cursor == current.stream.length - 1) && + (peekChar() == '\n'))) { + if (singleFile) return false; while (popFile()) { if (current.cursor < current.stream.length) return true; No revision No revision 1.13.2.2 +16 -12 jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java Index: PageContextImpl.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -u -r1.13.2.1 -r1.13.2.2 --- PageContextImpl.java 2001/12/05 18:41:46 1.13.2.1 +++ PageContextImpl.java 2001/12/12 01:28:39 1.13.2.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java,v 1.13.2.1 2001/12/05 18:41:46 kinman Exp $ - * $Revision: 1.13.2.1 $ - * $Date: 2001/12/05 18:41:46 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java,v 1.13.2.2 2001/12/12 01:28:39 kinman Exp $ + * $Revision: 1.13.2.2 $ + * $Date: 2001/12/12 01:28:39 $ * * ==================================================================== * @@ -169,15 +169,19 @@ } public void release() { - try { - if (isIncluded) { - ((JspWriterImpl)out).flushBuffer(); // push it into the including jspWriter - } else { - out.flush(); - } - } catch (IOException ex) { - loghelper.log("Internal error flushing the buffer in release()"); - } + // Flush the out stream only if the response is not committed. + if (! response.isCommitted()) { + try { + if (isIncluded) { + ((JspWriterImpl)out).flushBuffer(); + // push it into the including jspWriter + } else { + out.flush(); + } + } catch (IOException ex) { + loghelper.log("Internal error flushing the buffer in release()"); + } + } servlet = null; config = null; context = null;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>