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

Cybersource-rest-client-java failure under Java 17 #117

Open
fixedgigha opened this issue Dec 13, 2022 · 0 comments
Open

Cybersource-rest-client-java failure under Java 17 #117

fixedgigha opened this issue Dec 13, 2022 · 0 comments

Comments

@fixedgigha
Copy link

We use the cybersource-rest-client-java library for making merchant payments. Our code runs successfully under Java 11.

Porting to Java 17, we see the following failure when making API calls -

com.google.gson.JsonIOException: Failed making field 'java.io.Reader#lock' accessible; either change its visibility or write a custom TypeAdapter for its declaring type at com.google.gson.internal.reflect.ReflectionHelper.makeAccessible(ReflectionHelper.java:23) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:203) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112) at com.google.gson.Gson.getAdapter(Gson.java:531) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:137) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:211) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112) at com.google.gson.Gson.getAdapter(Gson.java:531) at com.google.gson.Gson.toJson(Gson.java:778) at com.google.gson.Gson.toJson(Gson.java:756) at com.google.gson.Gson.toJson(Gson.java:711) at com.google.gson.Gson.toJson(Gson.java:691) at Invokers.JSON.serialize(JSON.java:83) at Invokers.ApiClient.execute(ApiClient.java:1204) at Api.PaymentsApi.createPaymentWithHttpInfo(PaymentsApi.java:161) at Api.PaymentsApi.createPayment(PaymentsApi.java:146)

This all seems to come from one single line of debug logging in the ApliClient. execute method -

logger.debug("Network Response :\n" + json.serialize(response.headers()));

The response object here is an OK HTTP object, with Java IO members that do not work for this reflective serialization under Java 17

I have built my own copy of the library with this one line removed, and the code works for me under Java 17,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant