mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
close resource which did not happen certainly
This commit is contained in:
parent
90631eff60
commit
c2c395420e
1 changed files with 6 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue