mobile/android/base/sync/CredentialException.java

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:48ed03183cf6
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 package org.mozilla.gecko.sync;
6
7 import android.content.SyncResult;
8
9 /**
10 * There was a problem with the Sync account's credentials: bad username,
11 * missing password, malformed sync key, etc.
12 */
13 public abstract class CredentialException extends SyncException {
14 private static final long serialVersionUID = 833010553314100538L;
15
16 public CredentialException() {
17 super();
18 }
19
20 public CredentialException(final Throwable e) {
21 super(e);
22 }
23
24 public void updateStats(GlobalSession globalSession, SyncResult syncResult) {
25 syncResult.stats.numAuthExceptions += 1;
26 }
27
28 /**
29 * No credentials at all.
30 */
31 public static class MissingAllCredentialsException extends CredentialException {
32 private static final long serialVersionUID = 3763937096217604611L;
33
34 public MissingAllCredentialsException() {
35 super();
36 }
37
38 public MissingAllCredentialsException(final Throwable e) {
39 super(e);
40 }
41 }
42
43 /**
44 * Some credential is missing.
45 */
46 public static class MissingCredentialException extends CredentialException {
47 private static final long serialVersionUID = -7543031216547596248L;
48
49 public final String missingCredential;
50
51 public MissingCredentialException(final String missingCredential) {
52 this.missingCredential = missingCredential;
53 }
54 }
55 }

mercurial