use of com.android.voicemail.impl.mail.MessagingException in project android_packages_apps_Dialer by LineageOS.
the class MimeMessage method getSentDate.
@Override
public Date getSentDate() throws MessagingException {
if (mSentDate == null) {
try {
DateTimeField field = (DateTimeField) DefaultFieldParser.parse("Date: " + MimeUtility.unfoldAndDecode(getFirstHeader("Date")));
mSentDate = field.getDate();
// TODO: We should make it more clear what exceptions can be thrown here,
// and whether they reflect a normal or error condition.
} catch (Exception e) {
LogUtils.v(LogUtils.TAG, "Message missing Date header");
}
}
if (mSentDate == null) {
// If we still don't have a date, fall back to "Delivery-date"
try {
DateTimeField field = (DateTimeField) DefaultFieldParser.parse("Date: " + MimeUtility.unfoldAndDecode(getFirstHeader("Delivery-date")));
mSentDate = field.getDate();
// TODO: We should make it more clear what exceptions can be thrown here,
// and whether they reflect a normal or error condition.
} catch (Exception e) {
LogUtils.v(LogUtils.TAG, "Message also missing Delivery-Date header");
}
}
return mSentDate;
}
use of com.android.voicemail.impl.mail.MessagingException in project android_packages_apps_Dialer by LineageOS.
the class ImapConnection method open.
public void open() throws IOException, MessagingException {
if (mTransport != null && mTransport.isOpen()) {
return;
}
try {
// copy configuration into a clean transport, if necessary
if (mTransport == null) {
mTransport = mImapStore.cloneTransport();
}
mTransport.open();
createParser();
// The server should greet us with something like
// * OK IMAP4rev1 Server
// consume the response before doing anything else.
ImapResponse response = mParser.readResponse(false);
if (!response.isOk()) {
mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_INVALID_INITIAL_SERVER_RESPONSE);
throw new MessagingException(MessagingException.AUTHENTICATION_FAILED_OR_SERVER_ERROR, "Invalid server initial response");
}
queryCapability();
maybeDoStartTls();
// LOGIN
doLogin();
} catch (SSLException e) {
LogUtils.d(TAG, "SSLException ", e);
mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_SSL_EXCEPTION);
throw new CertificateValidationException(e.getMessage(), e);
} catch (IOException ioe) {
LogUtils.d(TAG, "IOException", ioe);
mImapStore.getImapHelper().handleEvent(OmtpEvents.DATA_IOE_ON_OPEN);
throw ioe;
} finally {
destroyResponses();
}
}
use of com.android.voicemail.impl.mail.MessagingException in project android_packages_apps_Dialer by LineageOS.
the class ImapHelper method openImapFolder.
private ImapFolder openImapFolder(String modeReadWrite) {
try {
if (mImapStore == null) {
return null;
}
ImapFolder folder = new ImapFolder(mImapStore, ImapConstants.INBOX);
folder.open(modeReadWrite);
return folder;
} catch (MessagingException e) {
LogUtils.e(TAG, e, "Messaging Exception");
}
return null;
}
use of com.android.voicemail.impl.mail.MessagingException in project android_packages_apps_Dialer by LineageOS.
the class ImapHelper method closeNewUserTutorial.
public void closeNewUserTutorial() throws MessagingException {
ImapConnection connection = mImapStore.getConnection();
try {
String command = getConfig().getProtocol().getCommand(OmtpConstants.IMAP_CLOSE_NUT);
connection.executeSimpleCommand(command, false);
} catch (IOException ioe) {
throw new MessagingException(MessagingException.SERVER_ERROR, ioe.toString());
} finally {
connection.destroyResponses();
}
}
use of com.android.voicemail.impl.mail.MessagingException in project android_packages_apps_Dialer by LineageOS.
the class ImapHelper method fetchVoicemailPayload.
public boolean fetchVoicemailPayload(VoicemailFetchedCallback callback, final String uid) {
try {
mFolder = openImapFolder(ImapFolder.MODE_READ_WRITE);
if (mFolder == null) {
// This means we were unable to successfully open the folder.
return false;
}
Message message = mFolder.getMessage(uid);
if (message == null) {
return false;
}
VoicemailPayload voicemailPayload = fetchVoicemailPayload(message);
callback.setVoicemailContent(voicemailPayload);
return true;
} catch (MessagingException e) {
} finally {
closeImapFolder();
}
return false;
}
Aggregations