Part of the code downloads the file from some URL and saves it in a local file. A piece of cake. What could be wrong here?
protected long download(ProgressMonitor montitor) throws Exception{
long size = 0;
DataInputStream dis = new DataInputStream(is);
int read = 0;
byte[] chunk = new byte[chunkSize];
while( (read = dis.read(chunk)) != -1){
os.write(chunk, 0, read);
size += read;
if(montitor != null)
montitor.worked(read);
}
chunk = null;
dis.close();
os.flush();
os.close();
return size;
}
The reason I ask the question is that it works in 99.999% of cases and does not work properly if the computer that runs this code has antivirus software or some other protection software. I will blindly point my finger like this, because whenever I stop (or turn off) it, the code works fine again. The end result of such interference is that the MD5 of the downloaded file is not as expected, and a new saga begins.
, , , - "" , URL-, ? - ? ( Kasperksy Norton).
-1:
-, , . FTP- ( , FileZilla), apache commons ftp . , , FTP- ( ) . , is.read(..) IOException , . is.read(..) -1, , . , . , .