redhat-developer / redhat-developer/lsp4ij
LS Wizard should validate the configuration options are valid JSON
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 344
- Forks
- 113
- Avg merge
- 5h 22m
- Merged PRs (30d)
- 15
Description
In a user defined LS settings page, if you put invalid json into one of the configuration fields and apply the changes, IJ will throw an exception:
Error while parsing JSON Initialization Options for the language server 'f8f5f681-d78a-4011-bab1-e583018885e2'
com.google.gson.JsonSyntaxException: java.io.EOFException: End of input at line 3 column 1 path $.provideFormatter
at com.google.gson.internal.Streams.parse(Streams.java:59)
at com.google.gson.JsonParser.parseReader(JsonParser.java:102)
at com.google.gson.JsonParser.parseReader(JsonParser.java:70)
at com.redhat.devtools.lsp4ij.server.definition.launching.UserDefinedLanguageServerDefinition.getLanguageServerInitializationOptions(UserDefinedLanguageServerDefinition.java:104)
at com.redhat.devtools.lsp4ij.server.definition.launching.UserDefinedStreamConnectionProvider.getInitializationOptions(UserDefinedStreamConnectionProvider.java:68)
at com.redhat.devtools.lsp4ij.LanguageServerWrapper.lambda$start$0(LanguageServerWrapper.java:326)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.io.EOFException: End of input at line 3 column 1 path $.provideFormatter
at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1457)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:491)
at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:422)
at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:779)
at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:725)
at com.google.gson.internal.Streams.parse(Streams.java:49)
... 12 more
This should be caught before applying the changes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with UserDefinedLanguageServerDefinition.getLanguageServerInitializationOptions and the user-defined LS settings apply flow; the stack trace shows where invalid JSON currently fails. Trace how configuration fields are applied, then ensure malformed JSON is caught before changes are applied and verify that the exception no longer reaches language-server startup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100