Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Cybersource-rest-client-java failure under Java 17

Đang mở
#117 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
50/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu tại dòng ghi nhật ký debug trong ApiClient.execute gọi json.serialize(response.headers()), sau đó lần theo lỗi được báo cáo qua Invokers.JSON.serialize. Tái hiện một lệnh gọi API trên Java 17 và xác minh rằng việc ghi nhật ký response không còn gây ra exception về quyền truy cập phản chiếu của Gson, trong khi request vẫn hoàn tất thành công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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,

Ngôn ngữ chính
Java
Star
29
Fork
50
Merge trung bình
1 giờ 30 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CyberSource/cybersource-rest-client-java

Tất cả issue của CyberSource/cybersource-rest-client-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.