DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=27547>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=27547 extra "\n" in jsp output Summary: extra "\n" in jsp output Product: Tomcat 5 Version: 5.0.18 Platform: Sun OS/Version: Solaris Status: NEW Severity: Normal Priority: Other Component: Jasper AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] This may not a bug, but make us difficult to deploy our software. Our web site basically is a remote accessable file system. User can download the selected file to client's local machine. I implement a simple jsp file called get.jsp to allow user to select a file and down load the file. get.jsp ========== <%@ page import="java.io.*" %> <% try { //user input: filename String filename = request.getParameter("filename"); String destName = new File(filename).getName(); response.setContentType("application/x-download"); response.setHeader("Content-Disposition", "attachment; filename=" + destName); FileInputStream in = new FileInputStream(filename); byte[] buff = new byte[8192]; int len; while ((len = in.read(buff)) != -1) out.write(new String(buff, 0, len)); } catch (Exception e) { out.write(e.getMessage()); } %> ======= end of get.jsp ======= but, there are 2 extra '\n' on the tomcat work area get_jsp.java file. if I remove those 2 lines from the java program then the output file is identical with the original file. I also notice difference between tomcat 4.1.27 and 5.0.18 out.write("\n"); 5.0.18 changes double quotes to single quotes. ==== get_jsp.java for tomcat 5.0.18 ======== package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.io.*; public final class get_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static java.util.Vector _jspx_dependants; public java.util.List getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write('\n');<------------ extra statement try { //user input: filename String filename = request.getParameter("filename"); String destName = new File(filename).getName(); response.setContentType("application/x-download"); response.setHeader("Content-Disposition", "attachment; filename=" + destName); FileInputStream in = new FileInputStream(filename); byte[] buff = new byte[8192]; int len; while ((len = in.read(buff)) != -1) out.write(new String(buff, 0, len)); } catch (Exception e) { out.write(e.getMessage()); } out.write('\n');<------------ extra statement } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); } } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]