XMLImporter: make sure to close stream if exception occurs
This commit is contained in:
parent
bbbcd8eba5
commit
47e1c336e6
@ -71,12 +71,15 @@ public class XMLImporter implements JmeImporter {
|
|||||||
this.assetManager = assetManager;
|
this.assetManager = assetManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
in.close();
|
return load(in);
|
||||||
return obj;
|
} finally {
|
||||||
|
if (in != null)
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Savable load(File f) throws IOException {
|
public Savable load(File f) throws IOException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user