-
assigned issue to
The network fails to open when it is empty
Issue #295
resolved
If in OpenMarkov 0.2.0 the user clicks on the menu File -> New... and creates a new network and, without adding a new node, clicks on File -> Save and reopen, OpenMarkov raises and exception. The stack-trace is as follows:
Missing Variables node (at line 3, column 35)
org.openmarkov.io.probmodel.exception.PGMXParserException: Missing Variables node (at line 3, column 35)
at org.openmarkov.io.probmodel.PGMXReader.getVariables(PGMXReader.java:593)
at org.openmarkov.io.probmodel.PGMXReader.getVariablesLinksAndPotentials(PGMXReader.java:228)
at org.openmarkov.io.probmodel.PGMXReader.getProbNet(PGMXReader.java:182)
at org.openmarkov.io.probmodel.PGMXReader.getProbNet(PGMXReader.java:165)
at org.openmarkov.io.probmodel.PGMXReader.loadProbNetInfo(PGMXReader.java:148)
at org.openmarkov.io.probmodel.PGMXReader.loadProbNet(PGMXReader.java:140)
at org.openmarkov.io.probmodel.PGMXReader.loadProbNet(PGMXReader.java:117)
at org.openmarkov.core.gui.dialog.io.NetsIO.openNetworkFile(NetsIO.java:56)
at org.openmarkov.core.gui.window.MainPanelListenerAssistant.openNetwork(MainPanelListenerAssistant.java:768)
at org.openmarkov.core.gui.window.MainPanelListenerAssistant.saveOpenNetwork(MainPanelListenerAssistant.java:597)
at org.openmarkov.core.gui.window.MainPanelListenerAssistant.actionPerformed(MainPanelListenerAssistant.java:189)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Comments (7)
-
reporter -
It could be fixed by modifying getVariables method, replacing:
if ( xmlVariablesRoot == null ) { throw new PGMXParserException( "Missing Variables node", root ); }
by
if ( xmlVariablesRoot == null ) { return; }
I think it's no necessary to throw an exception if the network has not any node. But currently OM doesn't allow to save a network in this state (see that "Save" menu is disabled although "Save as" and "Save and reopen" are enabled).
-
-
assigned issue to
We must allow to save a network that has not any variable
-
assigned issue to
-
- changed status to resolved
Now PGMXParserException is captured, the message sent to the console for information purposes and the empty network is loaded.
-
-
assigned issue to
-
assigned issue to
-
- changed status to open
-
- changed status to resolved
Done
- Log in to comment