Skip to content

BadLocationException shows up in error log view #937

Closed

Description

@martinlippert

Seeing this in my error log view after trying a few things, so can't say exactly when and how this happened unfortunately. Maybe an LSP4E issue, maybe something on our side, not sure, but worth investigating.

org.eclipse.jface.text.BadLocationException
	at org.eclipse.jface.text.TreeLineTracker.fail(TreeLineTracker.java:1054)
	at org.eclipse.jface.text.TreeLineTracker.getLineInformationOfOffset(TreeLineTracker.java:1134)
	at org.eclipse.jface.text.AbstractLineTracker.getLineInformationOfOffset(AbstractLineTracker.java:234)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.getLineInformationOfOffset(BasicStructuredDocument.java:1476)
	at org.eclipse.lsp4e.LSPEclipseUtils.toPosition(LSPEclipseUtils.java:167)
	at org.eclipse.lsp4e.operations.codeactions.LSPCodeActionQuickAssistProcessor.prepareCodeActionParams(LSPCodeActionQuickAssistProcessor.java:230)
	at org.eclipse.lsp4e.operations.codeactions.LSPCodeActionQuickAssistProcessor.computeQuickAssistProposals(LSPCodeActionQuickAssistProcessor.java:163)
	at org.eclipse.ui.internal.genericeditor.CompositeQuickAssistProcessor.computeQuickAssistProposals(CompositeQuickAssistProcessor.java:80)
	at org.eclipse.jface.text.quickassist.QuickAssistAssistant$ContentAssistProcessor.computeCompletionProposals(QuickAssistAssistant.java:71)
	at org.eclipse.jface.text.contentassist.ContentAssistant$2.lambda$0(ContentAssistant.java:2063)
	at java.base/java.util.Collections$SingletonSet.forEach(Collections.java:4905)
	at org.eclipse.jface.text.contentassist.ContentAssistant$2.run(ContentAssistant.java:2062)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:2059)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:577)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.lambda$0(CompletionProposalPopup.java:507)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:502)
	at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1873)
	at org.eclipse.jface.text.quickassist.QuickAssistAssistant.showPossibleQuickAssists(QuickAssistAssistant.java:113)
	at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:985)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1468)
	at org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor$1.doOperation(ExtensionBasedTextEditor.java:109)
	at org.eclipse.ui.texteditor.TextOperationAction.lambda$0(TextOperationAction.java:130)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:130)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
	at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:121)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
	at jdk.internal.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:308)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:580)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:647)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:439)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:96)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1217)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4641)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1547)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1532)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1561)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1557)
	at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:522)
	at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:1085)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:6492)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:59)
	at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:607)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:6324)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:236)
	at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2264)
	at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2511)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:6444)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5692)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5831)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:117)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3986)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
	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:402)
	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:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	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)

Activity

  1. added this to the 4.17.1.RELEASE milestone on Dec 30, 2022
  2. martinlippert commented on Dec 30, 2022

    @martinlippert
    MemberAuthor

    I found a way to reproduce this:

    • I have a simple Rest Service project in my workspace
    • a warning about a new Spring Boot version 3.0.1 shows up in the problems view
    • I open the pom.xml file
    • I scroll to the top of the file
    • I press Cmd-1 to show quick-fixes for the warnings at the top of the file
    • The above shown exception shows up in the error log view
  3. martinlippert commented on Dec 30, 2022

    @martinlippert
    MemberAuthor

    This happens only if the cursor is at position 0 of the first line and the quick-fix menu is invoked. If the cursor is at position 1, the exception doesn't happen.

  4. martinlippert commented on Jan 11, 2023

    @martinlippert
    MemberAuthor

    Maybe related, this shows up in the language server log of my dev environment after refreshing the workspace (after pulling the latest changes from git):

    org.springframework.ide.vscode.commons.util.BadLocationException: null
    	at org.springframework.ide.vscode.commons.util.text.linetracker.ListLineTracker.getLineNumberOfOffset(ListLineTracker.java:139)
    	at org.springframework.ide.vscode.commons.util.text.linetracker.AbstractLineTracker.getLineNumberOfOffset(AbstractLineTracker.java:148)
    	at org.springframework.ide.vscode.commons.util.text.TextDocument.lineNumber(TextDocument.java:117)
    	at org.springframework.ide.vscode.commons.util.text.TextDocument.toPosition(TextDocument.java:122)
    	at org.springframework.ide.vscode.commons.util.text.TextDocument.toRange(TextDocument.java:108)
    	at org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer$3.accept(SimpleLanguageServer.java:762)
    	at org.springframework.ide.vscode.boot.java.handlers.BootJavaReconcileEngine.lambda$reconcile$9(BootJavaReconcileEngine.java:151)
    	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    	at org.springframework.ide.vscode.boot.java.handlers.BootJavaReconcileEngine.lambda$reconcile$10(BootJavaReconcileEngine.java:151)
    	at java.base/java.util.HashMap$EntrySet.forEach(HashMap.java:1126)
    	at org.springframework.ide.vscode.boot.java.handlers.BootJavaReconcileEngine.reconcile(BootJavaReconcileEngine.java:149)
    	at org.springframework.ide.vscode.boot.app.BootLanguageServerInitializer.lambda$validateProject$8(BootLanguageServerInitializer.java:228)
    	at java.base/java.util.Optional.ifPresent(Optional.java:178)
    	at org.springframework.ide.vscode.boot.app.BootLanguageServerInitializer.lambda$validateProject$9(BootLanguageServerInitializer.java:227)
    	at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:171)
    	at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:539)
    	at reactor.core.publisher.MonoPublishOn$PublishOnSubscriber.run(MonoPublishOn.java:181)
    	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
    	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
    	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    	at java.base/java.lang.Thread.run(Thread.java:833)
    
  5. BoykoAlex commented on Jan 11, 2023

    @BoykoAlex
    Contributor

    LSP4E issue eclipse-lsp4e/lsp4e#355 with an easy fix.

  6. martinlippert commented on Jan 12, 2023

    @martinlippert
    MemberAuthor

    Closed as duplicate of fixed issue in lsp4e eclipse-lsp4e/lsp4e#355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsestatus: duplicatetheme: refactoringtype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions