I have changed the read method. but still that exception. File is fully read but while writing it on stream exception occer. I have print the file size in logger. that is actual size of file. this will happen when file size is greater then or equal to 2 MB
{
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
File aFile = new File(filePath);
InputStream is = new FileInputStream(aFile);
byte[] temp = new byte[1024];
int read;
while((read = is.read(temp)) > 0){
buffer.write(temp, 0, read);
}
byte[] data = buffer.toByteArray();
return data;
}
INFO 07 Jan 2009 20:50:19,156 (DownlaodManager.java:105) - Url for file is D:/arif/download-data/img/bowlinehearder.bmp
INFO 07 Jan 2009 20:50:19,156 (DownlaoderServlet.java:62) - fileUrl D:/arif/download-data/img/bowlinehearder.bmp
INFO 07 Jan 2009 20:50:19,453 (DownlaoderServlet.java:79) - fie size 2880054
INFO 07 Jan 2009 20:50:19,531 (DownlaoderServlet.java:89) - error in writing file on stream
ClientAbortException: java.net.SocketException: Software caused connection abort: socket write error
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:366)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:323)