ensured closing of zipinputstream resource
@@ -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 zipInputStream = null;
+ try {
+ zipInputStream = new ZipInputStream(stream);
zipInputStream.getNextEntry();
return new ObjectMapper().readValue(zipInputStream, ref);
+ } finally {
+ StreamUtils.closeQuietly(zipInputStream);
+ }
+
}
public static Map<String, JsonSet> sets() {
