IllegalStateException: No node currently selected - when program is loaded from file

Hello,
I’m creating a new URCap and I’ve faced a problem, which seems to be in URCaps SDK. This problem is reproduciable with “Hello World Swing” sample from the sdk.

Steps to reproduce:

  1. Download the SDK 1.3.55
  2. Go to the samples/swing folder and install helloworldswing URCap on URSim 3.6. (To do this you can just specify ursim.home at project’s pom.xml and run mvn install -P ursim)
  3. Run URSim, select Program Robot, Empty Program.
  4. Go to the Installation tab, Hello World Swing and enter a Popup title.
  5. Go to the Program tab, add Hello World Swing node to program.
  6. Save program to file.
  7. Close URSim.
  8. Start URSim again.
  9. Load the saved program.
  10. Click on text input in Hello World Swing node’s interface.

You’ve got the following exception:

ERROR [AWT-EventQueue-0] 11:32:43 13/08/18: Caught an unhandled exception
java.lang.IllegalStateException: No node currently selected.
	at com.ur.urcap.contribution.program.SwingProgramNodeViewProviderImpl$1.get(SwingProgramNodeViewProviderImpl.java:99)
	at com.ur.urcap.examples.helloworldswing.impl.HelloWorldProgramNodeView$1.mousePressed(HelloWorldProgramNodeView.java:60)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
	at java.awt.Component.processMouseEvent(Component.java:6536)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6304)
	at java.awt.Container.processEvent(Container.java:2239)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4532)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
	at java.awt.Container.dispatchEventImpl(Container.java:2283)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)

The exception is thrown then provider.get() is called.
It seems to me, that there is a bug in SDK, because in debug I can see, that the reference to Contribution is null, but the node is selected:


Proper working state, when there are no errors:

As a workaround, you can implement setContribution in your View and call it in Contribution.openView method view.setContribution(this). And in closeView - view.setContribution(null).
But it was expected to call provider.get() on ContributionProvider object and the example illustrates it.

Am I doing everything right?
Is there a bug in the SDK?
How can I fix it? Should I use the workaround I have described?

Related topics:

1 Like

I have completely avoided this exception with the workaround suggested above. implement setContribution in your View and call it in Contribution.openView method view.setContribution(this) And in closeView - view.setContribution(null). The setContribution method wraps a class member of the contribution node type, so you can use this for everything and don’t need to call provider.get() at all.

I am also having this issue. I have two program nodes. One of them allowsChildren(true) and the other (the child node) isUserInsertable(false). Everything seems to work fine until I try to focus on a textfield in the child node. Whenever I do this the error pops up. I have looked into solutions for this from the java swing end with not success.

Did you now find any proper solution ? Thanks for your response.

The new version 3.7 solves the problem according to the release notes .