1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/sync/CredentialException.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +package org.mozilla.gecko.sync; 1.9 + 1.10 +import android.content.SyncResult; 1.11 + 1.12 +/** 1.13 + * There was a problem with the Sync account's credentials: bad username, 1.14 + * missing password, malformed sync key, etc. 1.15 + */ 1.16 +public abstract class CredentialException extends SyncException { 1.17 + private static final long serialVersionUID = 833010553314100538L; 1.18 + 1.19 + public CredentialException() { 1.20 + super(); 1.21 + } 1.22 + 1.23 + public CredentialException(final Throwable e) { 1.24 + super(e); 1.25 + } 1.26 + 1.27 + public void updateStats(GlobalSession globalSession, SyncResult syncResult) { 1.28 + syncResult.stats.numAuthExceptions += 1; 1.29 + } 1.30 + 1.31 + /** 1.32 + * No credentials at all. 1.33 + */ 1.34 + public static class MissingAllCredentialsException extends CredentialException { 1.35 + private static final long serialVersionUID = 3763937096217604611L; 1.36 + 1.37 + public MissingAllCredentialsException() { 1.38 + super(); 1.39 + } 1.40 + 1.41 + public MissingAllCredentialsException(final Throwable e) { 1.42 + super(e); 1.43 + } 1.44 + } 1.45 + 1.46 + /** 1.47 + * Some credential is missing. 1.48 + */ 1.49 + public static class MissingCredentialException extends CredentialException { 1.50 + private static final long serialVersionUID = -7543031216547596248L; 1.51 + 1.52 + public final String missingCredential; 1.53 + 1.54 + public MissingCredentialException(final String missingCredential) { 1.55 + this.missingCredential = missingCredential; 1.56 + } 1.57 + } 1.58 +}