summaryrefslogtreecommitdiffstats
path: root/provider_src
diff options
context:
space:
mode:
authorTony Mantler <nicoya@google.com>2014-10-17 13:54:37 -0700
committerTony Mantler <nicoya@google.com>2014-10-20 17:20:59 +0000
commita2f1da2bdc127558c5e2e63eb7bc94df563b7d83 (patch)
tree1cff993e92cc6ea949772824027a0bbdeac5abe1 /provider_src
parentf61e098a4161dd52f1d81c577520ce96b617480d (diff)
downloadandroid_packages_apps_Email-a2f1da2bdc127558c5e2e63eb7bc94df563b7d83.tar.gz
android_packages_apps_Email-a2f1da2bdc127558c5e2e63eb7bc94df563b7d83.tar.bz2
android_packages_apps_Email-a2f1da2bdc127558c5e2e63eb7bc94df563b7d83.zip
Fix handling AOL's login rejection
Found while investigating b/18031180 b/18049329 Change-Id: I2c86449008fb5e89c84db1a0753b8a61f42305b9
Diffstat (limited to 'provider_src')
-rw-r--r--provider_src/com/android/email/mail/store/ImapConnection.java7
-rw-r--r--provider_src/com/android/email/mail/store/ImapStore.java9
-rw-r--r--provider_src/com/android/email/mail/store/imap/ImapResponse.java7
3 files changed, 20 insertions, 3 deletions
diff --git a/provider_src/com/android/email/mail/store/ImapConnection.java b/provider_src/com/android/email/mail/store/ImapConnection.java
index 3e71774fb..bf4bb2a4c 100644
--- a/provider_src/com/android/email/mail/store/ImapConnection.java
+++ b/provider_src/com/android/email/mail/store/ImapConnection.java
@@ -344,6 +344,7 @@ class ImapConnection {
if (!response.isOk()) {
final String toString = response.toString();
+ final String status = response.getStatusOrEmpty().getString();
final String alert = response.getAlertTextOrEmpty().getString();
final String responseCode = response.getResponseCodeOrEmpty().getString();
destroyResponses();
@@ -353,7 +354,7 @@ class ImapConnection {
throw new MessagingException(MessagingException.SERVER_ERROR, alert);
}
- throw new ImapException(toString, alert, responseCode);
+ throw new ImapException(toString, status, alert, responseCode);
}
return responses;
}
@@ -505,12 +506,14 @@ class ImapConnection {
LogUtils.d(Logging.LOG_TAG, ie, "ImapException");
}
+ final String status = ie.getStatus();
final String code = ie.getResponseCode();
final String alertText = ie.getAlertText();
// if the response code indicates expired or bad credentials, throw a special exception
if (ImapConstants.AUTHENTICATIONFAILED.equals(code) ||
- ImapConstants.EXPIRED.equals(code)) {
+ ImapConstants.EXPIRED.equals(code) ||
+ (ImapConstants.NO.equals(status) && TextUtils.isEmpty(code))) {
throw new AuthenticationFailedException(alertText, ie);
}
diff --git a/provider_src/com/android/email/mail/store/ImapStore.java b/provider_src/com/android/email/mail/store/ImapStore.java
index 0aee551f7..5fc83e001 100644
--- a/provider_src/com/android/email/mail/store/ImapStore.java
+++ b/provider_src/com/android/email/mail/store/ImapStore.java
@@ -661,15 +661,22 @@ public class ImapStore extends Store {
static class ImapException extends MessagingException {
private static final long serialVersionUID = 1L;
+ private final String mStatus;
private final String mAlertText;
private final String mResponseCode;
- public ImapException(String message, String alertText, String responseCode) {
+ public ImapException(String message, String status, String alertText,
+ String responseCode) {
super(message);
+ mStatus = status;
mAlertText = alertText;
mResponseCode = responseCode;
}
+ public String getStatus() {
+ return mStatus;
+ }
+
public String getAlertText() {
return mAlertText;
}
diff --git a/provider_src/com/android/email/mail/store/imap/ImapResponse.java b/provider_src/com/android/email/mail/store/imap/ImapResponse.java
index 05bf594e6..9f975f7bf 100644
--- a/provider_src/com/android/email/mail/store/imap/ImapResponse.java
+++ b/provider_src/com/android/email/mail/store/imap/ImapResponse.java
@@ -120,6 +120,13 @@ public class ImapResponse extends ImapList {
return getStringOrEmpty(getElementOrNone(1).isList() ? 2 : 1);
}
+ public ImapString getStatusOrEmpty() {
+ if (!isStatusResponse()) {
+ return ImapString.EMPTY;
+ }
+ return getStringOrEmpty(0);
+ }
+
@Override
public String toString() {
String tag = mTag;