Ale46 / Mega-Java

Java library for the mega.co.nz API
44 stars 20 forks source link

Unreliable downloads #9

Closed BullyWiiPlaza closed 8 years ago

BullyWiiPlaza commented 8 years ago

When downloading files from Mega, sometimes exceptions like the following occur:

java.io.IOException: Server returned HTTP response code: 500 for URL: https://g.api.mega.co.nz/cs?id=886954536
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at application.downloader.mega.MegaHandler.api_request(MegaHandler.java:69)
    at application.downloader.mega.MegaHandler.download(MegaHandler.java:138)
    at application.downloader.mega.MegaHandler.download(MegaHandler.java:107)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
    at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
    at org.json.JSONObject.<init>(JSONObject.java:195)
    at org.json.JSONObject.<init>(JSONObject.java:319)
    at application.downloader.mega.MegaHandler.download(MegaHandler.java:138)
    at application.downloader.mega.MegaHandler.download(MegaHandler.java:107)

This happens for the same file so it's an unreliable download. If possible, please fix this.

Note that the line numbers given are wrong since I slightly edited the code myself as well but that is not the reason for the instability.

Ale46 commented 8 years ago

Currently, with the official mega sdk, this project is deprecated and spending time trying to figure out what generate this exception is useless imho. If you want to try to solve the bug go ahead, I will be happy to merge an eventually pull..

Regards