You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's an odd test case, but I usually can repeat this sequence:
While viewing a valid Yang file, select some text in the buffer.
Select entire buffer.
Press Delete to empty buffer.
This will often result in the following stacktrace:
java.lang.NullPointerException
at com.cisco.yangide.editor.editors.YangEditor$YangEditorSelectionChangedListener.selectionChanged(YangEditor.java:154)
at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2751)
at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2699)
at org.eclipse.jface.text.TextViewer$5.run(TextViewer.java:2678)
at org.eclipse.swt.widgets.Display.timerProc(Display.java:4406)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2425)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3428)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Here is the method in question at the top of stack:
privateclassYangEditorSelectionChangedListenerextendsAbstractSelectionChangedListener {
@OverridepublicvoidselectionChanged(SelectionChangedEventevent) {
if (event.getSelection() instanceofITextSelection) {
ITextSelectiontextSelection = (ITextSelection) event.getSelection();
try {
if (null != outlinePage) { // next line is line 154outlinePage.selectNode(getModule().getNodeAtPosition(textSelection.getOffset()));
}
} catch (YangModelExceptione) {
}
}
}
}
From debugging, I found that "getModule()" returns null in this situation, although there also appears to be a race condition in play that I don't clearly understand. I tried adding an "if" specifically for "getModule() == null" before the "if" on line 153, with a print statement saying that "getModule()" returned null. I set a breakpoint there, and when I hit that, I executed "getModule()" in the display view, and it gave me a non-null value.
It seems safe to amend the "if" condition on line 153, adding "null != getModule()". A brief comment about this situation before the "if" would be beneficial also.
The text was updated successfully, but these errors were encountered:
It's an odd test case, but I usually can repeat this sequence:
This will often result in the following stacktrace:
Here is the method in question at the top of stack:
From debugging, I found that "getModule()" returns null in this situation, although there also appears to be a race condition in play that I don't clearly understand. I tried adding an "if" specifically for "getModule() == null" before the "if" on line 153, with a print statement saying that "getModule()" returned null. I set a breakpoint there, and when I hit that, I executed "getModule()" in the display view, and it gave me a non-null value.
It seems safe to amend the "if" condition on line 153, adding "null != getModule()". A brief comment about this situation before the "if" would be beneficial also.
The text was updated successfully, but these errors were encountered: