phonegap / phonegap-plugin-contentsync

Download and cache remotely hosted content
Apache License 2.0
206 stars 98 forks source link

Replace of data after connection aborted (HTTP code 400 or 500) #162

Closed kgmav closed 7 years ago

kgmav commented 7 years ago

this problem occours on Android

the download function in Sync.java returns a true if the connection get a HTTP code != 200. If the connection aborted the exception is catched here and after finaly the function is leave with a true in place of false

} catch (Throwable e) {
            try {
                sendErrorMessage(e.getLocalizedMessage(), CONNECTION_ERROR, callbackContext, connection.getResponseCode());
            } catch (IOException ioe) {
            }
        } finally {
            if (connection != null) {
                // Revert back to the proper verifier and socket factories
                if (trustEveryone && useHttps) {
                    HttpsURLConnection https = (HttpsURLConnection) connection;
                    https.setHostnameVerifier(oldHostnameVerifier);
                    https.setSSLSocketFactory(oldSocketFactory);
                }
            }
        }

        return true;
}
macdonst commented 7 years ago

@kgmav can you install the latest from master and let me know if it fixes your specific issue?

bugsmafia commented 7 years ago

/project/src/com/adobe/phonegap/contentsync/Sync.java:304: error: ';' expected retval = false ^ /project/src/com/adobe/phonegap/contentsync/Sync.java:316: error: ';' expected retval = false ^ /project/src/com/adobe/phonegap/contentsync/Sync.java:331: error: ';' expected retval = false ^ /project/src/com/adobe/phonegap/contentsync/Sync.java:344: error: ';' expected retval = false ^

kgmav commented 7 years ago

@macdonst yes that it's