use of com.android.voicemail.impl.mail.MessagingException in project android_packages_apps_Dialer by LineageOS.
the class ImapFolder method doSelect.
/**
* Selects the folder for use. Before performing any operations on this folder, it must be
* selected.
*/
private void doSelect() throws IOException, MessagingException {
final List<ImapResponse> responses = mConnection.executeSimpleCommand(String.format(Locale.US, ImapConstants.SELECT + " \"%s\"", mName));
// Assume the folder is opened read-write; unless we are notified otherwise
mMode = MODE_READ_WRITE;
int messageCount = -1;
for (ImapResponse response : responses) {
if (response.isDataResponse(1, ImapConstants.EXISTS)) {
messageCount = response.getStringOrEmpty(0).getNumberOrZero();
} else if (response.isOk()) {
final ImapString responseCode = response.getResponseCodeOrEmpty();
if (responseCode.is(ImapConstants.READ_ONLY)) {
mMode = MODE_READ_ONLY;
} else if (responseCode.is(ImapConstants.READ_WRITE)) {
mMode = MODE_READ_WRITE;
}
} else if (response.isTagged()) {
// Not OK
mStore.getImapHelper().handleEvent(OmtpEvents.DATA_MAILBOX_OPEN_FAILED);
throw new MessagingException("Can't open mailbox: " + response.getStatusResponseTextOrEmpty());
}
}
if (messageCount == -1) {
throw new MessagingException("Did not find message count during select");
}
mMessageCount = messageCount;
mExists = true;
}
use of com.android.voicemail.impl.mail.MessagingException in project android_packages_apps_Dialer by LineageOS.
the class ImapResponseParser method parseLiteral.
private ImapString parseLiteral() throws IOException, MessagingException {
expect('{');
final int size;
try {
size = Integer.parseInt(readUntil('}'));
} catch (NumberFormatException nfe) {
throw new MessagingException("Invalid length in literal");
}
if (size < 0) {
throw new MessagingException("Invalid negative length in literal");
}
expect('\r');
expect('\n');
FixedLengthInputStream in = new FixedLengthInputStream(mIn, size);
if (size > mLiteralKeepInMemoryThreshold) {
return new ImapTempFileLiteral(in);
} else {
return new ImapMemoryLiteral(in);
}
}
Aggregations