From 9402c4a59c53bf8024e195933d802cdafdc3d2ba Mon Sep 17 00:00:00 2001 From: Marc Zwart Date: Tue, 20 Mar 2018 15:19:59 +0100 Subject: [PATCH] ensured closing of zipinputstream resource --- Mage.Verify/src/main/java/mage/verify/MtgJson.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Mage.Verify/src/main/java/mage/verify/MtgJson.java b/Mage.Verify/src/main/java/mage/verify/MtgJson.java index b187667140..e0b2d133ee 100644 --- a/Mage.Verify/src/main/java/mage/verify/MtgJson.java +++ b/Mage.Verify/src/main/java/mage/verify/MtgJson.java @@ -2,6 +2,7 @@ package mage.verify; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import mage.util.StreamUtils; import java.io.File; import java.io.FileInputStream; @@ -94,9 +95,15 @@ public final class MtgJson { } stream = new FileInputStream(file); } - ZipInputStream zipInputStream = new ZipInputStream(stream); - zipInputStream.getNextEntry(); - return new ObjectMapper().readValue(zipInputStream, ref); + ZipInputStream zipInputStream = null; + try { + zipInputStream = new ZipInputStream(stream); + zipInputStream.getNextEntry(); + return new ObjectMapper().readValue(zipInputStream, ref); + } finally { + StreamUtils.closeQuietly(zipInputStream); + } + } public static Map sets() {