ensured closing of zipinputstream resource

This commit is contained in:
Marc Zwart 2018-03-20 15:19:59 +01:00
parent ccb0d3da52
commit 9402c4a59c

View file

@ -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() {