From c2c395420e7bf116a6541c87f22c50520cb04392 Mon Sep 17 00:00:00 2001 From: Marc Zwart Date: Thu, 22 Mar 2018 10:30:10 +0100 Subject: [PATCH] close resource which did not happen certainly --- .../org/mage/plugins/card/images/DownloadPictures.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java index 99491554acc..5755522b1be 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java @@ -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); }