Bug 579294 - NPE in TextViewer.computeSelection
Summary: NPE in TextViewer.computeSelection
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.22   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.24 M1   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
: 579343 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-03-17 06:33 EDT by Denis Ungemach CLA
Modified: 2022-06-17 08:24 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Ungemach CLA 2022-03-17 06:33:23 EDT
Hello there is a Nullpointer Exception in TextViewer. 

I'll push a bugfix to gerrit.

java.lang.NullPointerException: Cannot invoke "org.eclipse.swt.custom.StyledText.getSelectionRanges()" because "this.fTextWidget" is null
 at org.eclipse.jface.text.TextViewer.computeSelection(TextViewer.java:2525)
 at org.eclipse.jface.text.TextViewer.getSelection(TextViewer.java:2481)
 at org.eclipse.debug.internal.ui.views.variables.VariablesView$SelectionProviderWrapper.getSelection(VariablesView.java:205)
 at org.eclipse.ui.internal.services.WorkbenchSourceProvider.updateSelection(WorkbenchSourceProvider.java:129)
 at org.eclipse.ui.internal.services.WorkbenchSourceProvider.getCurrentState(WorkbenchSourceProvider.java:112)
 at org.eclipse.ui.internal.services.WorkbenchSourceProvider.lambda$2(WorkbenchSourceProvider.java:614)
 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
 at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1280)
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1059)
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1084)
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1069)
 at org.eclipse.swt.widgets.Decorations.WM_ACTIVATE(Decorations.java:1521)
 at org.eclipse.swt.widgets.Shell.WM_ACTIVATE(Shell.java:2314)
 at org.eclipse.swt.widgets.Control.windowProc(Control.java:4750)
 at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
 at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1480)
 at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2286)
 at org.eclipse.swt.widgets.Display.windowProc(Display.java:5002)
 at org.eclipse.swt.internal.win32.OS.DestroyWindow(Native Method)
 at org.eclipse.swt.widgets.Control.destroyWidget(Control.java:782)
 at org.eclipse.swt.widgets.Shell.destroyWidget(Shell.java:732)
 at org.eclipse.swt.widgets.Widget.release(Widget.java:826)
 at org.eclipse.swt.widgets.Widget.dispose(Widget.java:423)
 at org.eclipse.swt.widgets.Decorations.dispose(Decorations.java:392)
 at org.eclipse.jface.window.Window.close(Window.java:335)
 at org.eclipse.jface.dialogs.Dialog.close(Dialog.java:988)
 at org.eclipse.ui.internal.statushandlers.InternalDialog.close(InternalDialog.java:651)
 at org.eclipse.jface.dialogs.Dialog.okPressed(Dialog.java:948)
 at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:468)
 at org.eclipse.ui.internal.statushandlers.InternalDialog.buttonPressed(InternalDialog.java:185)
 at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
 at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
 at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
 at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4243)
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)
 at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4060)
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3632)
 at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1154)
 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
 at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1045)
 at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
 at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
 at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
 at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.base/java.lang.reflect.Method.invoke(Method.java:566)
 at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
 at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
 at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
Comment 1 Eclipse Genie CLA 2022-03-17 07:23:34 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.text/+/191989
Comment 3 Sebastian Ratz CLA 2022-03-17 09:26:00 EDT
Thanks, Denis!
Comment 4 Andrey Loskutov CLA 2022-03-21 04:38:18 EDT
*** Bug 579343 has been marked as a duplicate of this bug. ***
Comment 5 Andrey Loskutov CLA 2022-03-21 04:49:09 EDT
Seem to be regression from bug 466532, however that was changed in 4.22, not in 4.23, so there must be something else changed that uncovered this NPE.

@Denis, Gunnar: was there any additional error in the log before the NPE?
Comment 6 Denis Ungemach CLA 2022-03-21 05:20:00 EDT
@Andrey Loskutov
No, no other error in the error log. 

This NPE was not reproducible and a very rare encounter.

I've looked into the source code and i've found the regression.

Best regards,
Denis
Comment 7 Sebastian Ratz CLA 2022-03-21 06:27:41 EDT
This problem was actually found in a 4.22.

I've corrected the "Version" flag.

Sorry for the confusion.
Comment 8 Marcel Ablasser CLA 2022-05-11 06:04:40 EDT
Is it possible to release this bug fix to the Eclipse update site https://download.eclipse.org/releases/2021-12/?

Unfortunately, this bug happens often if one uses the compare view.

I would really appreciate it.
Comment 9 Gary Johnston CLA 2022-06-17 08:24:02 EDT
I second the Marcel's request.