KNIME NodeModelFactory view count error handling



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.






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.
at org.knime.core.node.NodeDescription27Proxy.getViewName(
at org.knime.core.node.NodeFactory.getNodeViewName(
at org.knime.core.node.Node.getViewName(
at org.knime.core.node.workflow.SingleNodeContainer.getNodeViewName(
at org.knime.core.node.workflow.NodeContainer.getViewName(
at org.eclipse.jface.action.Action.runWithEvent(
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(
at org.eclipse.jface.action.ActionContributionItem.access$2(
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(
at org.eclipse.swt.widgets.EventTable.sendEvent(
at org.eclipse.swt.widgets.Widget.sendEvent(
at org.eclipse.swt.widgets.Display.runDeferredEvents(
at org.eclipse.swt.widgets.Display.readAndDispatch(
at org.eclipse.ui.internal.Workbench.runEventLoop(
at org.eclipse.ui.internal.Workbench.runUI(
at org.eclipse.ui.internal.Workbench.access$4(
at org.eclipse.ui.internal.Workbench$
at org.eclipse.core.databinding.observable.Realm.runWithDefault(
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(
at org.knime.product.rcp.KNIMEApplication.start(
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.eclipse.equinox.launcher.Main.invokeFramework(
at org.eclipse.equinox.launcher.Main.basicRun(

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;



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.





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