KNIME NodeModelFactory view count error handling

Hi

 

It appears the way an error with a view is caught has changed? In one of my nodes I had forgotten to change the number of views from 1 to 0 in the NodeModelFactory. 

 

Previously this would just throw an error to the console. In 2.8 this corrups the right click menu for the node (and others unless they are highlighted with a left click first). 

 

I fixed my node as I was the cause in the error but I thought the way that 2.8 handled the error may not be an intended change so I'm reporting it anyway.

 

Cheers

 

Sam

 

ERROR  OpenViewAction  The view for node 'Multi Performance 0:8' has thrown a 'NullPointerException'. That is most likely an implementation error.
DEBUG  OpenViewAction  The view for node 'Multi Performance 0:8' has thrown a 'NullPointerException'. That is most likely an implementation error.
java.lang.NullPointerException
at org.knime.core.node.NodeDescription27Proxy.getViewName(NodeDescription27Proxy.java:264)
at org.knime.core.node.NodeFactory.getNodeViewName(NodeFactory.java:483)
at org.knime.core.node.Node.getViewName(Node.java:1700)
at org.knime.core.node.workflow.SingleNodeContainer.getNodeViewName(SingleNodeContainer.java:325)
at org.knime.core.node.workflow.NodeContainer.getViewName(NodeContainer.java:1082)
at org.knime.workbench.editor2.actions.OpenViewAction.run(OpenViewAction.java:126)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.knime.product.rcp.KNIMEApplication.start(KNIMEApplication.java:128)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

It's not supposed to throw an NPE. Can you send me the factory XML?

Maybe I'm doing something else wrong to?

 

My procedure would be to create a new node with the wizard. Implement the dialog and node model. When not creating a view I would then delete the view section from the NodeFactory.xml. 

I would then change:

public int getNrNodeViews()
{
    return 1;
}

 

to

public int getNrNodeViews() 
{
    return 0;
}

 

This error is seen if I forget to do the last step. 

 

I've attached the node factory xml and java files in the configuration that they failed. 

 

This is the console output for 2.7.4:

ERROR MultiPerformanceNodeFactory CODING PROBLEM Missing or surplus view description.

 

Cheers

 

Sam

No, you only made one mistake ;-) There really shouldn't be an NPE in such cases. It's already fixed for 2.8.1.