close resource which did not happen certainly

This commit is contained in:
Marc Zwart 2018-03-22 10:30:10 +01:00
parent 90631eff60
commit c2c395420e

View file

@ -755,11 +755,13 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
if (responseCode == 200) {
// download OK
// save data to temp
BufferedOutputStream out = null;
BufferedInputStream in = null;
OutputStream out = null;
OutputStream tfileout = null;
InputStream in = null;
try {
in = new BufferedInputStream(httpConn.getInputStream());
out = new BufferedOutputStream(new TFileOutputStream(fileTempImage));
tfileout = new TFileOutputStream(fileTempImage);
out = new BufferedOutputStream(tfileout);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) != -1) {
@ -789,6 +791,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
finally {
StreamUtils.closeQuietly(in);
StreamUtils.closeQuietly(out);
StreamUtils.closeQuietly(tfileout);
}