Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExceptionInInitializerError in ApiContext.create #127

Closed
tbotting opened this issue Apr 21, 2020 · 4 comments
Closed

ExceptionInInitializerError in ApiContext.create #127

tbotting opened this issue Apr 21, 2020 · 4 comments
Assignees

Comments

@tbotting
Copy link

Tried bunq version 1.21.1, 1.13.0 and 1.13.1. All have the same issue since this morning. It used to work for weeks before this.

API_CONTEXT = ApiContext.create(ApiEnvironmentType.PRODUCTION, BUNQ_API_KEY, "Bunq Device");

is causing:

Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $.director_alias at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226) 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) at com.google.gson.Gson.fromJson(Gson.java:994) at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:162) at com.bunq.sdk.json.SessionServerAdapter.deserialize(SessionServerAdapter.java:57) at com.bunq.sdk.json.SessionServerAdapter.deserialize(SessionServerAdapter.java:23) at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) at com.google.gson.Gson.fromJson(Gson.java:927) at com.google.gson.Gson.fromJson(Gson.java:994) at com.google.gson.Gson.fromJson(Gson.java:967) at com.bunq.sdk.model.core.BunqModel.fromJsonArrayNested(BunqModel.java:69) at com.bunq.sdk.model.core.SessionServer.create(SessionServer.java:78) at com.bunq.sdk.context.ApiContext.initializeSession(ApiContext.java:272) at com.bunq.sdk.context.ApiContext.initialize(ApiContext.java:225) at com.bunq.sdk.context.ApiContext.create(ApiContext.java:140) at com.bunq.sdk.context.ApiContext.create(ApiContext.java:122) at com.bunq.sdk.context.ApiContext.create(ApiContext.java:114) at com.payments.Bunq.<clinit>(Bunq.java:20) Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $.director_alias at com.google.gson.internal.bind.JsonTreeReader.expect(JsonTreeReader.java:162) at com.google.gson.internal.bind.JsonTreeReader.beginObject(JsonTreeReader.java:87) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:215) ... 19 more

@InhouseMedia
Copy link

Having the same issue for the C# SDK. It's been 24 hours now!

@Nayels
Copy link

Nayels commented Apr 24, 2020

I've been experiencing the same issue since Tuesday. They made a change in the response of the Bunq API for the new Bunq +1 functionality.

Best would be to fork the SDK and change the director_alias

NilsTellow added a commit to NilsTellow/sdk_java that referenced this issue Apr 28, 2020
- Change director_alias in UserCompany to list bunq#127
- Bump okio dependency to 1.17.5 bunq#120
@NilsTellow
Copy link

@InhouseMedia
@tbotting

As this is a breaking bug for some companies. I've made a fork that fixes the above problem.
https://github.com/NilsTellow/sdk_java/
It can be pulled from JItpack. Same as Bunq SDK.
https://jitpack.io/#NilsTellow/sdk_java

Keep in mind that this a temporary fix, as I do not know what they will change in the API for the bug fix.

@angelomelonas
Copy link
Contributor

Hi everyone,

This issue has been resolved in the latest release (1.14.0). As @Nayels pointed out, a new field was added to the response and the SDKs have since been regenerated to accompany this change.

You can view the diff between 1.13.1 and 1.14.0 for the UserCompany.java endpoint here.

@angelomelonas angelomelonas self-assigned this Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants