Extension hangs with org.eclipse.jface.text.BadLocationException
See original GitHub issuePretty often when I am refactoring my code and there (one or two files contain pretty broken code) - extension hangs and all it’s features stop working.
Restarting VSCode fixes the issue.
My project is super simple (5 classes), has rudimentary pom.xml.
Output window for Language Support for Java shows this error:
[Error - 9:07:53 PM] Aug 1, 2018 9:07:02 PM
null
org.eclipse.jface.text.BadLocationException
at org.eclipse.jface.text.TreeLineTracker.fail(TreeLineTracker.java:1051)
at org.eclipse.jface.text.TreeLineTracker.lineByOffset(TreeLineTracker.java:265)
at org.eclipse.jface.text.TreeLineTracker.getLineNumberOfOffset(TreeLineTracker.java:1119)
at org.eclipse.jface.text.AbstractLineTracker.getLineNumberOfOffset(AbstractLineTracker.java:151)
at org.eclipse.jface.text.AbstractDocument.getLineOfOffset(AbstractDocument.java:868)
at org.eclipse.core.internal.filebuffers.SynchronizableDocument.getLineOfOffset(SynchronizableDocument.java:331)
at org.eclipse.jdt.ls.core.internal.handlers.JsonRpcHelpers.toLine(JsonRpcHelpers.java:60)
at org.eclipse.jdt.ls.core.internal.JDTUtils.toRange(JDTUtils.java:466)
at org.eclipse.jdt.ls.core.internal.JDTUtils.toLocation(JDTUtils.java:380)
at org.eclipse.jdt.ls.core.internal.JDTUtils.toLocation(JDTUtils.java:342)
at org.eclipse.jdt.ls.core.internal.handlers.DocumentSymbolHandler.collectChildren(DocumentSymbolHandler.java:75)
at org.eclipse.jdt.ls.core.internal.handlers.DocumentSymbolHandler.collectChildren(DocumentSymbolHandler.java:68)
at org.eclipse.jdt.ls.core.internal.handlers.DocumentSymbolHandler.getOutline(DocumentSymbolHandler.java:52)
at org.eclipse.jdt.ls.core.internal.handlers.DocumentSymbolHandler.documentSymbol(DocumentSymbolHandler.java:44)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$12(JDTLanguageServer.java:532)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$23(JDTLanguageServer.java:732)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Same error and stack dump can be found in the log that I open with “Java: Open Java Language Server log file”.
(related?) Dev Tools console log contains quite a lot copies of this warning:
WARN Error: listener failed
at workbench.main.js:sourcemap:4061
at Object.g [as _notify] (workbench.main.js:sourcemap:150)
at Object.enter (workbench.main.js:sourcemap:154)
at n.Class.derive._oncancel._run (workbench.main.js:sourcemap:155)
at n.Class.derive._oncancel._completed (workbench.main.js:sourcemap:155)
at e.resolveOk (workbench.main.js:sourcemap:3060)
at e._receiveReply (workbench.main.js:sourcemap:3127)
at e._receiveOneMessage (workbench.main.js:sourcemap:3126)
at workbench.main.js:sourcemap:3125
at workbench.main.js:sourcemap:3128
at e.fire (workbench.main.js:sourcemap:171)
at c (workbench.main.js:sourcemap:302)
at Socket.<anonymous> (workbench.main.js:sourcemap:303)
at emitOne (events.js:96)
at Socket.emit (events.js:191)
at readableAddChunk (_stream_readable.js:178)
at Socket.Readable.push (_stream_readable.js:136)
at Pipe.onread (net.js:560)
I was experiencing the same issue with the previous version of the extension.
When extension hangs, VSCode status bar usually says “Validating document - 0%”
Environment
- Operating System: Win10 v1803
- JDK version: 1.8.0_181
- Visual Studio Code version: 1.25.1
- Java extension version: 0.29.0
Steps To Reproduce
Not quite sure about the pattern or repro yet, but happens like every hour (=pretty often).
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:16
Top Results From Across the Web
532557 – BadLocationException below ... - Bugs
The following problem was reported via the automated error reporting: Message: HIDDEN org.eclipse.jface.text.BadLocationException: null at ...
Read more >AbstractDocument (Eclipse Platform API Specification) - IBM
Abstract default implementation of IDocument and its extension interfaces ... Nested classes/interfaces inherited from interface org.eclipse.jface.text.
Read more >LinkedPosition (Eclipse Platform API Specification)
Clients may extend this class. ... Fields inherited from class org.eclipse.jface.text. ... Throws: BadLocationException - if the position is not valid ...
Read more >How can I import eclipse JDT classes in a project
jface.text.BadLocationException; import org.eclipse.text.edits.TextEdit;. How can I import the JDT within Eclipse? Cheers.
Read more >Java > Open Source Codes > org > eclipse > jface > text ...
28 * Abstract default implementation of <code>IDocument</code> and its extension 29 * interfaces {@link org.eclipse.jface.text.IDocumentExtension},
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I find a surefire way to reproduce this is to annotate a class with ToString using Lombok. I have yet to experience this working without getting stuck at validate documents 0%.
Got same issue here, best way to reproduce is to modify few files quickly and save.