mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
ensured closing of zipinputstream resource
This commit is contained in:
parent
ccb0d3da52
commit
9402c4a59c
1 changed files with 10 additions and 3 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue