You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 -
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,
The text was updated successfully, but these errors were encountered: