delthas / JavaSkype

A lightweight, comprehensive Java API for Skype using MSNP24
MIT License
72 stars 28 forks source link

fr.delthas.skype.ParseException: org.json.JSONException: Unterminated string at 1041975 [character 1041976 line 1] #22

Closed MrPowerGamerBR closed 7 years ago

MrPowerGamerBR commented 7 years ago
An error occured while connecting...
fr.delthas.skype.ParseException: org.json.JSONException: Unterminated string at 1041975 [character 1041976 line 1]
    at fr.delthas.skype.WebConnector.updateContacts(WebConnector.java:97)
    at fr.delthas.skype.WebConnector.start(WebConnector.java:43)
    at fr.delthas.skype.Skype.connect(Skype.java:113)
    at fr.delthas.skype.Skype.connect(Skype.java:87)
    at com.mrpowergamerbr.sparklywhistlerbot.utils.DebugSkype.main(DebugSkype.java:25)
Caused by: org.json.JSONException: Unterminated string at 1041975 [character 1041976 line 1]
    at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
    at org.json.JSONTokener.nextString(JSONTokener.java:261)
    at org.json.JSONTokener.nextValue(JSONTokener.java:361)
    at org.json.JSONObject.<init>(JSONObject.java:215)
    at org.json.JSONTokener.nextValue(JSONTokener.java:364)
    at org.json.JSONArray.<init>(JSONArray.java:116)
    at org.json.JSONTokener.nextValue(JSONTokener.java:367)
    at org.json.JSONObject.<init>(JSONObject.java:215)
    at org.json.JSONObject.<init>(JSONObject.java:319)
    at fr.delthas.skype.WebConnector.updateContacts(WebConnector.java:90)
    ... 4 more

Full skype.log https://gist.github.com/MrPowerGamerBR/ea81dc8c0a108f3076eaf7fc2bdabe75

This only happens with my main account

MrPowerGamerBR commented 7 years ago

And, to help debugging, here is the profilesResponse that caused this issue

http://mrpowergamerbr.com/assets/skype-dump.txt

(1MB file!)

delthas commented 7 years ago

Hahahaha, it looks like you have so many friends the Skype server is not even able to send all the information in one response. I'll look into that. Thanks :)

delthas commented 7 years ago

@MrPowerGamerBR
Could you send me a skypeToken you get from the server? Just print the "skypeToken" field in WebConnector in updateContacts() before the error. This will let me debug much more easily.

Does this happen all the time (100%), with your main account, by the way?

MrPowerGamerBR commented 7 years ago

@Delthas I tried three times, all three times it failed to connect. (but they had different exceptions (the character line is different in all three exceptions)

(And yes, I have 995 (!) contacts on my Skype, that's what happens when you are a Minecraft server owner and accepts all contact requests I guess)

Skype Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEyIn0.eyJpYXQiOjE0ODQwNDMxNTcsImV4cCI6MTQ4NDEyOTU1Nywic2t5cGVpZCI6Im1ycG93ZXJnYW1lcmJyIiwic2NwIjo5NTYsImNzaSI6IjEiLCJjaWQiOiJjOTAwMGI1NGMzNzY1YzIifQ.tG2n0py_QSYZlHRq7rEl7n9QGs0h8ObVCWKCWoZkzCNerGzSOrgPwQQL_3mfTxY6lfiUMf-5eHlSFvhF--0GVIyAD3IoF3r7Rxtacu81KICiAd-Byplt5CZvyaaSZ-yWj6EzqOjrK5MBFBUtENOhMVp85aWunLd5-oI1G6d0Uqg-e2etClDS4rRxXYV52AerqfMJig34B75YLa6v

delthas commented 7 years ago

I think I've fixed this too! The reason was that the response from the Skype server was larger than 1MB, which is by default the largest size my HTTP library can handle. I've increased the maximum size for requests to the Skype server. 😄 (Tell me if this works (when your PC recovers :(), added in 1.0.17)