ryerrabelli / jmonkeyengine

Automatically exported from code.google.com/p/jmonkeyengine
0 stars 0 forks source link

Write error while fixing nifty xml files #395

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Have syntax errors inside a Nifty XML file
2. When activating the nifty preview, you will see errors like "XML parse 
error" etc etc. This is correct and should happen.
3. Now switch to the XML editing tab and fix the error, sometimes you might 
need 2-3 errors in the file to see the issue.
4. Press the "Save All" button in the top left of jMP

What is the expected output? What do you see instead?
I expect the XML to be saved successfully. Instead I see an error (see 
attachment)

Original issue reported on code.google.com by ShadowIs...@gmail.com on 4 Sep 2011 at 8:54

Attachments:

GoogleCodeExporter commented 8 years ago
This issue must be due to the nifty object not closing the file properly when 
theres issues and should be fixed by either the niftygui developer or the 
developer of the jme3 implementation:

            public Object call() throws Exception {
                try {
                    nifty.fromXml(pm.getRelativeAssetPath(niftyObject.getPrimaryFile().getPath()), screen);
                    if (screen == null || screen.length() == 0) {
                        Collection<String> screens = nifty.getAllScreensName();
                        for (Iterator<String> it = screens.iterator(); it.hasNext();) {
                            String string = it.next();
                            nifty.gotoScreen(string);
                            return null;
                        }
                    }
                } catch (Exception ex) {
                    Message msg = new NotifyDescriptor.Message(
                            "Error opening File:" + ex,
                            NotifyDescriptor.ERROR_MESSAGE);
                    DialogDisplayer.getDefault().notifyLater(msg);
                    Exceptions.printStackTrace(ex);
                }
                return null;
            }

Original comment by normen667 on 4 Sep 2011 at 9:36