EGerrit com.google.gson.JsonSyntaxException, wrong JSON response from REST-API

176 views
Skip to first unread message

Brian Preuß

unread,
Oct 19, 2016, 8:00:44 AM10/19/16
to Repo and Gerrit Discussion
Hi there,

I just tried to retrieve the list of all open changed from our Gerrit Repository (Version 2.13.1) within Eclipse (Version 4.6.0, Neon Release) by using the EGerrit (Version 4.4.0) Dashboard. This gives me a JsonSyntaxException as the JSON response from Gerrit contains strange characters at the beginning.

Is this a bug?

Eclipse error details:
eclipse.buildId=4.6.0.I20160606-1100
java.version=1.8.0_101
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product

org.eclipse.egerrit.core
Error
Wed Oct 19 13:38:21 CEST 2016
Plug-in Version: 1.0.0.527
Gerrit server: https://gerrit.pirobase.de
Version: 2.13.1
Transport error occurred GET https://gerrit.pirobase.de/a/changes/?o=DETAILED_LABELS&o=CURRENT_REVISION&o=CURRENT_FILES&o=DETAILED_ACCOUNTS&o=CURRENT_COMMIT&o=REVIEWED&q=status%3Aopen

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 1390
    at org.eclipse.egerrit.internal.core.command.EMFTypeAdapterFactory$EObjectTypeAdapter.read(EMFTypeAdapterFactory.java:119)
    at org.eclipse.egerrit.internal.core.command.EMFTypeAdapterFactory$EObjectTypeAdapter.read(EMFTypeAdapterFactory.java:1)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
    at com.google.gson.Gson.fromJson(Gson.java:803)
    at com.google.gson.Gson.fromJson(Gson.java:768)
    at org.eclipse.egerrit.internal.core.command.BaseCommand$1.handleResponse(BaseCommand.java:142)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:218)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:160)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:136)
    at org.eclipse.egerrit.internal.core.GerritHttpClient.execute(GerritHttpClient.java:153)
    at org.eclipse.egerrit.internal.core.command.BaseCommand.call(BaseCommand.java:145)
    at org.eclipse.egerrit.internal.core.command.QueryChangesCommand.call(QueryChangesCommand.java:101)
    at org.eclipse.egerrit.internal.dashboard.ui.views.GerritTableView.performQuery(GerritTableView.java:1107)
    at org.eclipse.egerrit.internal.dashboard.ui.views.GerritTableView.getReviewList(GerritTableView.java:1086)
    at org.eclipse.egerrit.internal.dashboard.ui.views.GerritTableView.getReviews(GerritTableView.java:1058)
    at org.eclipse.egerrit.internal.dashboard.ui.views.GerritTableView.access$13(GerritTableView.java:1008)
    at org.eclipse.egerrit.internal.dashboard.ui.views.GerritTableView$12.run(GerritTableView.java:884)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 1390
    at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:338)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:79)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
    at org.eclipse.egerrit.internal.core.command.EMFTypeAdapterFactory$EObjectTypeAdapter.read(EMFTypeAdapterFactory.java:115)
    ... 18 more

response from Gerrit:
)]}'
[
  {
    "id": "xxx",
    "project": "xxx",
    "branch": "master",
...

Regards,

Brian Preuß

Edwin Kempin

unread,
Oct 19, 2016, 8:03:14 AM10/19/16
to Brian Preuß, Repo and Gerrit Discussion
On Wed, Oct 19, 2016 at 1:54 PM, Brian Preuß <brian....@gmail.com> wrote:
Hi there,

I just tried to retrieve the list of all open changed from our Gerrit Repository (Version 2.13.1) within Eclipse (Version 4.6.0, Neon Release) by using the EGerrit (Version 4.4.0) Dashboard. This gives me a JsonSyntaxException as the JSON response from Gerrit contains strange characters at the beginning.

Is this a bug?

--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Matthias Sohn

unread,
Oct 19, 2016, 8:04:26 AM10/19/16
to Brian Preuß, Repo and Gerrit Discussion
On Wed, Oct 19, 2016 at 1:54 PM, Brian Preuß <brian....@gmail.com> wrote:
Hi there,

I just tried to retrieve the list of all open changed from our Gerrit Repository (Version 2.13.1) within Eclipse (Version 4.6.0, Neon Release) by using the EGerrit (Version 4.4.0) Dashboard. This gives me a JsonSyntaxException as the JSON response from Gerrit contains strange characters at the beginning.


Gerrit does this to protect against cross-site scripting see

-Matthias
 

--

Brian Preuß

unread,
Oct 19, 2016, 8:37:04 AM10/19/16
to Repo and Gerrit Discussion, brian....@gmail.com
Ok, thank you very much. This must be a bug in EGerrit then :)

--
--
To unsubscribe, email repo-discuss...@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

Brian Preuß

unread,
Oct 20, 2016, 8:20:38 AM10/20/16
to Repo and Gerrit Discussion, brian....@gmail.com
Just found a correspondig bug for EGerrit https://bugs.eclipse.org/bugs/show_bug.cgi?id=502411. It's solved for version 1.2.
Reply all
Reply to author
Forward
0 new messages