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