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

Serialization conflict with 'thumbnail' field in InputPaidMedia and InputPaidMediaVideo classes #396

Closed
mr-koibash opened this issue Aug 29, 2024 · 1 comment

Comments

@mr-koibash
Copy link

Hi, I've encountered an issue while working with the InputPaidMedia and InputPaidMediaVideo classes in your library. There seems to be a serialization conflict due to the 'thumbnail' field being present in both classes.

Details:

  • The InputPaidMedia class has a thumbnail field.
  • The InputPaidMediaVideo class, which extends InputPaidMedia, also has a thumbnail field.
  • This causes a conflict during JSON serialization/deserialization, resulting in the following error:
Exception in thread "main" java.lang.IllegalArgumentException: Class com.pengrad.telegrambot.model.request.InputPaidMediaVideo declares multiple JSON fields named 'thumbnail'; conflict is caused by fields com.pengrad.telegrambot.model.request.InputPaidMediaVideo#thumbnail and com.pengrad.telegrambot.model.request.InputPaidMedia#thumbnail
  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:302)
  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:130)
  at com.google.gson.Gson.getAdapter(Gson.java:556)
  at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:55)
  at com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:104)
  at com.google.gson.Gson.toJson(Gson.java:842)
  at com.google.gson.Gson.toJson(Gson.java:812)
  at com.google.gson.Gson.toJson(Gson.java:759)
  at com.google.gson.Gson.toJson(Gson.java:736)
  at com.pengrad.telegrambot.impl.TelegramBotClient.toParamValue(TelegramBotClient.java:149)
  at com.pengrad.telegrambot.impl.TelegramBotClient.createRequestBody(TelegramBotClient.java:137)
  at com.pengrad.telegrambot.impl.TelegramBotClient.createRequest(TelegramBotClient.java:101)
  at com.pengrad.telegrambot.impl.TelegramBotClient.send(TelegramBotClient.java:77)
  at com.pengrad.telegrambot.TelegramBot.execute(TelegramBot.java:45)

Environment:

  • Library version: 7.9.0
  • Java version: 21
@pengrad
Copy link
Owner

pengrad commented Aug 30, 2024

Whole "SendPaidMedia" was working incorrectly.
Fixed in 7.9.1
Thank you!

@pengrad pengrad closed this as completed Aug 30, 2024
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

2 participants