SyncAdapter.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:unicef_gis_mobile 作者:
private void handleException(String authtoken, Exception e,
        SyncResult syncResult) {
    if (e instanceof AuthenticatorException) {
        syncResult.stats.numParseExceptions++;
        Log.e("SyncAdapter", "AuthenticatorException", e);
    } else if (e instanceof OperationCanceledException) {
        Log.e("SyncAdapter", "OperationCanceledExcepion", e);
    } else if (e instanceof IOException) {
        Log.e("SyncAdapter", "IOException", e);
        syncResult.stats.numIoExceptions++;
    } else if (e instanceof AuthenticationException) {
        accountManager.invalidateAuthToken(Authenticator.ACCOUNT_TYPE, authtoken);
        syncResult.stats.numIoExceptions++;
        if (authtoken != null)
            Log.e("SyncAdapter", "Auth failed, invalidating token: " + authtoken);
        Log.e("SyncAdapter", "AuthenticationException", e);
    } else if (e instanceof ParseException) {
        syncResult.stats.numParseExceptions++;
        Log.e("SyncAdapter", "ParseException", e);
    } else if (e instanceof JsonParseException) {
        syncResult.stats.numParseExceptions++;
        Log.e("SyncAdapter", "JSONException", e);
    } else if (e instanceof ServerUrlPreferenceNotSetException) {
        Log.e("SyncAdapter", "ServerUrlPreferenceNotSetException", e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号