summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorFred Quintana <fredq@google.com>2010-03-04 17:12:39 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-03-04 17:12:39 -0800
commitbcfcafe18c331bef98ea3f15665bcc3bac2aa544 (patch)
tree011f1e251f43eb77c8f3eb7d3e627858ff01251b /core
parent55535c83fd1409a9bafcc4ee69a7df2aec36f65c (diff)
parent96580e00654a052a82120c374c6b5961ef349a92 (diff)
downloadframeworks_base-bcfcafe18c331bef98ea3f15665bcc3bac2aa544.zip
frameworks_base-bcfcafe18c331bef98ea3f15665bcc3bac2aa544.tar.gz
frameworks_base-bcfcafe18c331bef98ea3f15665bcc3bac2aa544.tar.bz2
Merge "Defend against an unexpected null bundle that causes blockingGetAuthToken() to throw an NPE."
Diffstat (limited to 'core')
-rw-r--r--core/java/android/accounts/AccountManager.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index e2263fc..1bb1d0f 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -704,6 +704,15 @@ public class AccountManager {
throws OperationCanceledException, IOException, AuthenticatorException {
Bundle bundle = getAuthToken(account, authTokenType, notifyAuthFailure, null /* callback */,
null /* handler */).getResult();
+ if (bundle == null) {
+ // This should never happen, but it does, occasionally. If it does return null to
+ // signify that we were not able to get the authtoken.
+ // TODO: remove this when the bug is found that sometimes causes a null bundle to be
+ // returned
+ Log.e(TAG, "blockingGetAuthToken: null was returned from getResult() for "
+ + account + ", authTokenType " + authTokenType);
+ return null;
+ }
return bundle.getString(KEY_AUTHTOKEN);
}
@@ -1166,6 +1175,16 @@ public class AccountManager {
return this;
}
+ protected void set(Bundle bundle) {
+ // TODO: somehow a null is being set as the result of the Future. Log this
+ // case to help debug where this is occurring. When this bug is fixed this
+ // condition statement should be removed.
+ if (bundle == null) {
+ Log.e(TAG, "the bundle must not be null", new Exception());
+ }
+ super.set(bundle);
+ }
+
public abstract void doWork() throws RemoteException;
private Bundle internalGetResult(Long timeout, TimeUnit unit)