Nithanim / gw2api

A library that provides access to the api of Guild Wars 2.
Apache License 2.0
5 stars 1 forks source link

[bugged function] gw2api.characters().get(characters, apiKey) #14

Closed jligeza closed 8 years ago

jligeza commented 8 years ago

This function is going to raise an illegal argument exception if the characters array has more than 3 entries. It might work only the first time, but with each consecutive try, it breaks.

Also, if I run this function with a hard-coded name of one character, and run it over 3 times in a loop, it magically works.

I use java 7 SE.

Error log: http://pastebin.com/Xqq0APVV

Reproduction: http://pastebin.com/V5B4Ysbw

Nithanim commented 8 years ago

I shortly tested your issue on my account with similar code that you have given me. However, I cannot reproduce your issue and I cannot remotely imagine what causes it since it fails at a very weird point. I assume your problem happens in a single threaded environment. Would it be possible to send me one of your apikeys so I can test it with your characters since it does not happen for mime. You can use the email-address of my commits for that.

However, I most likely won't be able to fix anything before the middle of February.

jligeza commented 8 years ago

My API key is: 89E39309-876E-6749-BE04-DFEDD730F6624142DA05-C607-4B28-A4B1-207624FC3A6E Also, my project is Spring MVC.

Nithanim commented 8 years ago

Thank you for providing your apikey! I could instantly reproduce your Issue. There seems to be something special about your character ;)

Nithanim commented 8 years ago

The results are pretty inconsistent for me. I simply iterate through your characters the same way you did. But it crashes not always at the same position so I suspect there is somewhere a problem with memory (although there is not OutOfMemoryError) in combination with gson. You may have too much in your bank (with extra attributes) that it is too much to handle. I am really sorry, I don't have that much time right now do debug an external library or reimplement that with a new one :(

Nithanim commented 8 years ago

I really do hope that this fixes your issues. It was hard to track down but basically the ids of the traits in the specializations can be null if not set which could not be translated to a primitive. There is now a custom deserializer in place that skips every non-integer value. What I could not figure out is that your last character (Rel*) does return very strange ids for specializations and traits. I assume you have not loaded them since the overhaul of the specializations.

PS: A new snapshot should be available without the issues (hopefully).