olivernybroe / phpinsights-intellij

The IntelliJ integration of phpinsights
MIT License
18 stars 2 forks source link

bug: com.google.gson.JsonSyntaxException #6

Closed nunomaduro closed 5 years ago

nunomaduro commented 5 years ago

After installing phpinsights, and end up with this error:

com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 8193 path $.Code[20].message
    at com.google.gson.Gson.fromJson(Gson.java:942)
    at com.google.gson.Gson.fromJson(Gson.java:892)
    at com.google.gson.Gson.fromJson(Gson.java:841)
    at com.google.gson.Gson.fromJson(Gson.java:813)
    at com.phpinsights.phpinsights.PhpInsightsMessageProcessor.parseLine(PhpInsightsMessageProcessor.java:29)
    at com.jetbrains.php.tools.quality.QualityToolOutputProcessor.notifyTextAvailable(QualityToolOutputProcessor.java:26)
    at com.jetbrains.php.tools.quality.QualityToolProcessHandler.notifyTextAvailable(QualityToolProcessHandler.java:24)
    at com.intellij.execution.process.BaseOSProcessHandler$SimpleOutputReader.onTextAvailable(BaseOSProcessHandler.java:179)
    at com.intellij.util.io.BaseOutputReader.sendText(BaseOutputReader.java:211)
    at com.intellij.util.io.BaseOutputReader.processInput(BaseOutputReader.java:200)
    at com.intellij.util.io.BaseOutputReader.readAvailableNonBlocking(BaseOutputReader.java:114)
    at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:77)
    at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:155)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:224)
    at com.intellij.util.io.BaseDataReader.lambda$start$0(BaseDataReader.java:61)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 8193 path $.Code[20].message
    at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1568)
    at com.google.gson.stream.JsonReader.nextQuotedValue(JsonReader.java:1031)
    at com.google.gson.stream.JsonReader.nextString(JsonReader.java:815)
    at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:402)
    at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:390)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
    at com.google.gson.Gson.fromJson(Gson.java:927)
    ... 19 more
olivernybroe commented 5 years ago

Hmm sounds like it's not able to parse the data from the plugin.

Did you point it to a phpinsight script which is new enough to have the Json formatter?

olivernybroe commented 5 years ago

Hmm looking further at the message, it looks like it's failing on object 21 in codes array on the message field from the Json that's returned.

olivernybroe commented 5 years ago

The new version changed so this message won't be shown, a new more descriptive message is now in place and happened for you at issue #9.