Problem with added carrige returns in download of fixed length records.
Hi,
I'm hoping that someone can help me, I'm at a complete loss.
I am downloading fixed length text records from our extranet via JSP. The problem is that 8 addtional carrige returns are being added to the records somewhere during this process, rendering the files useless. The following is the code I'm using
<%
FileInputStream fInputStream =null;
String piccareD ="/usr/local/apache/tomcat/webapps/piccare/";
String filePath = piccareD +"x/" + request.getRemoteUser() +"/dnload/";
String fileName = request.getParameter("fileName");
int ch;
String dnloadFile = filePath + fileName;
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition","attachment;filename=" + dnloadFile);
Connection con = ConnectionServlet.getConnection();
try
{
fInputStream =new FileInputStream(dnloadFile);
while ( (ch = fInputStream.read() ) != -1)
{
out.write(ch);
}
log.logEvent(con, LogElement.DNLOAD, fileName);
log.setRetrieved(con, fileName, tStamp.getStamp());
if( ! (fileName.indexOf("archive/") > -1) )
{
String proc ="mv " + dnloadFile +" " + filePath +"archive/" + fileName;
Process mv = Runtime.getRuntime().exec( proc );
Thread.sleep(100);
int ec = mv.exitValue();
mv.destroy();
System.err.println( ec );
if( ec != 0 )
{
;
}
}
}catch (Exception e){
System.err.println(e.getMessage());
log.logEvent(con, LogElement.DNLOAD_ERR, fileName);
}
%>
Any help is sincerely appreciated.
Thank you!
bbean@timebridge.com

