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

LolChampSelectLegacyChampSelectPlayerSelection#spell1Id too long to be a Long #34

Open
obed-vazquez opened this issue Mar 8, 2023 · 2 comments

Comments

@obed-vazquez
Copy link
Contributor

obed-vazquez commented Mar 8, 2023

I think I've found a bug in the library when trying to map some summoner spells into a Java object.

Steps to reproduce

  1. Obtain a Champion-Select-time Session status ( LolChampSelectLegacyChampSelectSession ) with the /lol-champ-select/v1/session endpoint like:
LolChampSelectLegacyChampSelectSession champSelectSession =
				clientApi.executeGet("/lol-champ-select/v1/session", generated.LolChampSelectLegacyChampSelectSession.class).getResponseObject();
  1. Created a Personalized match (Summoner's Rift, Team Size: 5, Recruitment), picked a champion, and had automatically selected Teleport and Heal as summoner spells.
  2. Tried to pull the team information with the LolChampSelectLegacyChampSelectSession#myTeam field but the JSON to Java mapping interrupted the operation with this exception message:
com.stirante.lolclient.libs.com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected a long but was 18446744073709551615 at line 1 column 2421 path $.myTeam[1].spell1Id
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:323)
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:313)
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
        at com.stirante.lolclient.libs.com.google.gson.Gson.fromJson(Gson.java:887)
        at com.stirante.lolclient.libs.com.google.gson.Gson.fromJson(Gson.java:852)
        at com.stirante.lolclient.libs.com.google.gson.Gson.fromJson(Gson.java:801)
        at com.stirante.lolclient.libs.com.google.gson.Gson.fromJson(Gson.java:773)
        at com.stirante.lolclient.ClientApi.getResponse(ClientApi.java:530)
        at com.stirante.lolclient.ClientApi.executeGet(ClientApi.java:438)
        at org.white_sdev.white_lolpicker_client.service.LoLClientActions.getChampionSelectSessionStatus(LoLClientActions.java:87)
        at org.white_sdev.white_lolpicker_client.service.LoLClientActions.getCurrentMatchPlayer(LoLClientActions.java:62)
        at org.white_sdev.white_lolpicker_client.service.LoLClientActions.getCurrentMatchPlayerIntendedChampion(LoLClientActions.java:32)
        at org.white_sdev.white_lolpicker_client.tasks.ChampionSelectListener.getSelectedChampionName(ChampionSelectListener.java:72)
        at org.white_sdev.white_lolpicker_client.tasks.ChampionSelectListener.onClientConnected(ChampionSelectListener.java:34)
        at com.stirante.lolclient.ClientApi.setupApiWithLockfile(ClientApi.java:214)
        at com.stirante.lolclient.ClientApi.checkClientProcess(ClientApi.java:255)
        at com.stirante.lolclient.ClientApi.lambda$startProcessWatcher$0(ClientApi.java:278)
        at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.lang.NumberFormatException: Expected a long but was 18446744073709551615 at line 1 column 2421 path $.myTeam[1].spell1Id
        at com.stirante.lolclient.libs.com.google.gson.stream.JsonReader.nextLong(JsonReader.java:967)
        at com.stirante.lolclient.libs.com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:321)

Comments

  • It seems to be due to the Java Long maximum supported value, on LolChampSelectLegacyChampSelectPlayerSelection#spell1Id and I assume it is the same case for the 2nd spell too.
  • I'm not really sure if we are using Jackson but it seems that Jackson supports automatic mapping to a BigInteger which will be my suggestion for a solution.
    • This implementation will interfere with the automatically generated Classes if it is directly manually implemented but I can't think of another one.
@obed-vazquez
Copy link
Contributor Author

I'm requesting access to the repo so I can create a pull request with the proposed implementation.

remote: Permission to stirante/lol-client-java-api.git denied to obed-vazquez.
fatal: unable to access 'https://github.com/stirante/lol-client-java-api.git/': The requested URL returned error: 403

@stirante
Copy link
Owner

stirante commented Mar 8, 2023

A PR would be welcome, but it doesn't require write access. Fork the repository to your account, clone that fork locally, make changes, commit them, push them and then on GitHub you can make a PR.

A good example of a PR is this one: #33

Here is a much more in depth description of PRs: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request

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