- fix niftygui editor locking file when loading fails

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9110 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent edc7a8b37c
commit e9614a683a
  1. 14
      sdk/jme3-gui/src/com/jme3/gde/gui/multiview/NiftyPreviewPanel.java

@ -19,6 +19,8 @@ import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.Callable;
@ -124,8 +126,10 @@ public class NiftyPreviewPanel extends PanelView {
if (pm == null) {
Logger.getLogger(NiftyPreviewPanel.class.getName()).log(Level.WARNING, "No Project AssetManager found!");
}
InputStream in = null;
try {
doc = XMLUtil.parse(new InputSource(niftyObject.getPrimaryFile().getInputStream()), false, false, null, null);
in = niftyObject.getPrimaryFile().getInputStream();
doc = XMLUtil.parse(new InputSource(in), false, false, null, null);
NiftyFileNode rootContext = new NiftyFileNode(doc.getDocumentElement());
setRoot(rootContext);
comp.setRootContext(rootContext);
@ -136,6 +140,14 @@ public class NiftyPreviewPanel extends PanelView {
DialogDisplayer.getDefault().notifyLater(msg);
Exceptions.printStackTrace(ex);
return;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
}
SceneApplication.getApplication().enqueue(new Callable<Object>() {

Loading…
Cancel
Save