I have been struggling with this exception in my own project, and I went to the trouble to create a reproducible test case starting with the Hello World Swing example. I wasn’t sure what was causing the issue, so I made a number of changes to the example. The key change seems to be adding a second program node type in my URCap. Once I did this, I could reliably generate an exception. I then modified my URCap structure to match the pickorplace example, since that has two program nodes. They were in separate packages, so I split mine up that way too. It didn’t help. The exception only happens when you load a saved program. Things are okay with newly inserted nodes.
Below are the steps I followed to reproduce the issue plus the stack trace. I have my modified URCap source code in a tarball, but I don’t see a way to attach it here.
- Download latest sdk (1.3.55), install for ur 3.6
- Start with HelloWorldSwing example. Add some checkboxes and a second program node type (project attached, drop in SDK swing examples directory).
- Edit pom.xml to install to URSim in Docker (change ip-address, update activator bundle)
- Running URSim 3.6.1.30595 (Jun 19 2018)
- build and install using mvn install –P ursimvm
- Load Empty Program
- Add a Hello Exception node and a Hello Exception 2 node.
- Note that checkboxes can be clicked.
- Save program and exit URSIm
- Restart URSim and Load program again.
- Note that clicking checkboxes in Hello Exception Node 2 causes exception shown below.
Activator says Hello World!
Jul 29, 2018 6:17:16 PM com.steadystate.css.parser.CSSOMParser
WARNING: java.lang.ClassNotFoundException: com.steadystate.css.parser.SACParserCSS21 not found by org.w3c.css.sac [70]
Jul 29, 2018 6:17:16 PM com.steadystate.css.parser.CSSOMParser
WARNING: using the default ‘SACParserCSS21’ instead
ERROR [RobotState - PostMan] 18:17:28 29/07/18 RobotState$PostMan.work(line:263): RobotState messages are queued up: 4
Contrib says Something
Contrib says Something
ERROR [AWT-EventQueue-0] 18:17:59 29/07/18: Caught an unhandled exception
java.lang.IllegalStateException: No node currently selected.
at com.ur.urcap.contribution.program.SwingProgramNodeViewProviderImpl$1.get(SwingProgramNodeViewProviderImpl.java:100)
at com.ur.urcap.examples.helloworldswing.node2.HelloWorldNode2View$2.actionPerformed(HelloWorldNode2View.java:61)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:308)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2238)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2296)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4897)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4534)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4475)
at java.awt.Container.dispatchEventImpl(Container.java:2282)
at java.awt.Window.dispatchEventImpl(Window.java:2746)