XMLImporter: make sure to close stream if exception occurs

This commit is contained in:
shadowislord 2015-02-28 18:29:38 -05:00
parent bbbcd8eba5
commit 47e1c336e6

View File

@ -74,9 +74,12 @@ public class XMLImporter implements JmeImporter {
public Object load(AssetInfo info) throws IOException { public Object load(AssetInfo info) throws IOException {
assetManager = info.getManager(); assetManager = info.getManager();
InputStream in = info.openStream(); InputStream in = info.openStream();
Savable obj = load(in); try {
return load(in);
} finally {
if (in != null)
in.close(); in.close();
return obj; }
} }
public Savable load(File f) throws IOException { public Savable load(File f) throws IOException {