Open cxbrooks opened 16 years ago
(Reporter: Edward Lee)
If I delete a state in FSM and try to undo, I get the following exception. Particularly, changing the sr/demo/TrafficLight demo from European to US can't be undone.
ptolemy.kernel.util.InternalErrorException: ChangeRequest failed (NOTE: there is no ChangeListener):
Because: Cannot create entity without a class name. in [external stream] at line 12 and column 71 at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:202) at ptolemy.moml.MoMLUndoEntry.execute(MoMLUndoEntry.java:102) at ptolemy.kernel.undo.UndoStackAttribute$MergeUndoActions.execute(UndoStackAttribute.java:319) at ptolemy.kernel.undo.UndoStackAttribute.undo(UndoStackAttribute.java:290) at ptolemy.kernel.undo.UndoChangeRequest._execute(UndoChangeRequest.java:85) at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:139) at ptolemy.kernel.util.NamedObj.executeChangeRequests(NamedObj.java:697) at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1671) at ptolemy.actor.CompositeActor.requestChange(CompositeActor.java:1184) at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1654) at ptolemy.vergil.basic.BasicGraphFrame.undo(BasicGraphFrame.java:1298) at ptolemy.vergil.basic.BasicGraphFrame$UndoAction.actionPerformed(BasicGraphFrame.java:2849) at javax.swing.JComponent$ActionStandin.actionPerformed(JComponent.java:3236) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1576) at javax.swing.JComponent.processKeyBinding(JComponent.java:2772) at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:255) at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:204) at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2849) at javax.swing.JComponent.processKeyBindings(JComponent.java:2841) at javax.swing.JComponent.processKeyEvent(JComponent.java:2735) at java.awt.Component.processEvent(Component.java:5379) at java.awt.Container.processEvent(Container.java:2010) at java.awt.Component.dispatchEventImpl(Component.java:4068) at java.awt.Container.dispatchEventImpl(Container.java:2068) at java.awt.Component.dispatchEvent(Component.java:3903) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1826) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:681) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:938) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:810) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:645) at java.awt.Component.dispatchEventImpl(Component.java:3941) at java.awt.Container.dispatchEventImpl(Container.java:2068) at java.awt.Window.dispatchEventImpl(Window.java:1801) at java.awt.Component.dispatchEvent(Component.java:3903) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110) Caused by: com.microstar.xml.XmlException: Cannot create entity without a class name. in [external stream] at line 12 and column 71 at ptolemy.moml.MoMLParser._checkForNull(MoMLParser.java:3664) at ptolemy.moml.MoMLParser._createEntity(MoMLParser.java:3837) at ptolemy.moml.MoMLParser.startElement(MoMLParser.java:2425) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:921) at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924) at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924) at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924) at com.microstar.xml.XmlParser.parseDocument(XmlParser.java:481) at com.microstar.xml.XmlParser.doParse(XmlParser.java:159) at com.microstar.xml.XmlParser.parse(XmlParser.java:132) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1364) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1337) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1492) at ptolemy.moml.MoMLChangeRequest._execute(MoMLChangeRequest.java:270) at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:139) ... 39 more Caused by: com.microstar.xml.XmlException: Cannot create entity without a class name. in [external stream] at line 12 and column 71 at ptolemy.moml.MoMLParser._checkForNull(MoMLParser.java:3664) at ptolemy.moml.MoMLParser._createEntity(MoMLParser.java:3837) at ptolemy.moml.MoMLParser.startElement(MoMLParser.java:2425) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:921) at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924) at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924) at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924) at com.microstar.xml.XmlParser.parseDocument(XmlParser.java:481) at com.microstar.xml.XmlParser.doParse(XmlParser.java:159) at com.microstar.xml.XmlParser.parse(XmlParser.java:132) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1364) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1337) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1492) at ptolemy.moml.MoMLChangeRequest._execute(MoMLChangeRequest.java:270) at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:139) at ptolemy.moml.MoMLUndoEntry.execute(MoMLUndoEntry.java:102) at ptolemy.kernel.undo.UndoStackAttribute$MergeUndoActions.execute(UndoStackAttribute.java:319) at ptolemy.kernel.undo.UndoStackAttribute.undo(UndoStackAttribute.java:290) at ptolemy.kernel.undo.UndoChangeRequest._execute(UndoChangeRequest.java:85) at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:139) at ptolemy.kernel.util.NamedObj.executeChangeRequests(NamedObj.java:697) at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1671) at ptolemy.actor.CompositeActor.requestChange(CompositeActor.java:1184) at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1654) at ptolemy.vergil.basic.BasicGraphFrame.undo(BasicGraphFrame.java:1298) at ptolemy.vergil.basic.BasicGraphFrame$UndoAction.actionPerformed(BasicGraphFrame.java:2849) at javax.swing.JComponent$ActionStandin.actionPerformed(JComponent.java:3236) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1576) at javax.swing.JComponent.processKeyBinding(JComponent.java:2772) at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:255) at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:204) at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2849) at javax.swing.JComponent.processKeyBindings(JComponent.java:2841) at javax.swing.JComponent.processKeyEvent(JComponent.java:2735) at java.awt.Component.processEvent(Component.java:5379) at java.awt.Container.processEvent(Container.java:2010) at java.awt.Component.dispatchEventImpl(Component.java:4068) at java.awt.Container.dispatchEventImpl(Container.java:2068) at java.awt.Component.dispatchEvent(Component.java:3903) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1826) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:681) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:938) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:810) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:645) at java.awt.Component.dispatchEventImpl(Component.java:3941) at java.awt.Container.dispatchEventImpl(Container.java:2068) at java.awt.Window.dispatchEventImpl(Window.java:1801) at java.awt.Component.dispatchEvent(Component.java:3903) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Edward writes: More on this:
The bug isn't with FSM, but with the class mechanism. A simpler way to replicate it:
In an empty model, create an instance of Sources/Sinewave Look inside. Delete something. Undo.
Edward writes: I'm checking in a major improvement to this undo bug, but there is still at least one remaining bug. Deleting certain ports doesn't undo undo properly yet. To replicate:
Create a new model. Put an instance of Sinewave in it. Look inside the Sinewave. Delete the output port. Undo.
You get an exception because the undo code tries to replicate the connection in the instance, which it is not allowed to do.
The short summary: Undo did not work if you delete objects from a class definition that is in a separate file from instances that are currently open if the instances override the class in any way.
It now works for entities, relations, and attributes, but not quite yet for ports.
Edward
Note: the issue was created automatically with bugzilla2github tool
Original bug ID: BZ#204 From: Bert Rodiers <bert.rodiers@gmail.com> Reported version: 7.1.devel CC: pt-dev@chess.eecs.berkeley.edu