1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Merge pull request #144 from owncloud/bug_1722_maintenance_mode

Handle 503 code error
This commit is contained in:
David A. Velasco 2017-01-10 18:57:54 +01:00 committed by GitHub
commit 67665b8691
2 changed files with 45 additions and 39 deletions

View File

@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}

View File

@ -34,6 +34,7 @@ import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import android.accounts.Account;
import android.accounts.AccountsException;
@ -61,9 +62,10 @@ import javax.net.ssl.SSLException;
*/
public class RemoteOperationResult implements Serializable {
/** Generated - should be refreshed every time the class changes!! */;
private static final long serialVersionUID = 1129130415603799707L;
/** Generated - should be refreshed every time the class changes!! */
;
private static final long serialVersionUID = -1909603208238358633L;
private static final String TAG = RemoteOperationResult.class.getSimpleName();
public enum ResultCode {
@ -112,7 +114,8 @@ public class RemoteOperationResult implements Serializable {
WRONG_SERVER_RESPONSE,
INVALID_CHARACTER_DETECT_IN_SERVER,
DELAYED_FOR_WIFI,
LOCAL_FILE_NOT_FOUND
LOCAL_FILE_NOT_FOUND,
MAINTENANCE_MODE
}
private boolean mSuccess = false;
@ -160,6 +163,9 @@ public class RemoteOperationResult implements Serializable {
case HttpStatus.SC_FORBIDDEN:
mCode = ResultCode.FORBIDDEN;
break;
case HttpStatus.SC_SERVICE_UNAVAILABLE:
mCode = ResultCode.MAINTENANCE_MODE;
break;
default:
mCode = ResultCode.UNHANDLED_HTTP_CODE;
Log_OC.d(TAG, "RemoteOperationResult has processed UNHANDLED_HTTP_CODE: " +
@ -366,7 +372,7 @@ public class RemoteOperationResult implements Serializable {
} else if (mException instanceof AccountNotFoundException) {
Account failedAccount =
((AccountNotFoundException)mException).getFailedAccount();
((AccountNotFoundException) mException).getFailedAccount();
return mException.getMessage() + " (" +
(failedAccount != null ? failedAccount.name : "NULL") + ")";