Search in sources :

Example 26 with PasswordException

use of i2p.bote.fileencryption.PasswordException in project i2p.i2p-bote by i2p.

the class OutboxProcessor method run.

@Override
public void run() {
    while (!Thread.interrupted()) {
        try {
            synchronized (this) {
                wakeupSignal = new CountDownLatch(1);
            }
            if (networkStatusSource.isConnected()) {
                log.debug("Processing outgoing emails in directory '" + outbox.getStorageDirectory() + "'.");
                FolderIterator<Email> iterator = outbox.iterate();
                try {
                    while (iterator.hasNext()) {
                        Email email = iterator.next();
                        log.info("Processing email with message Id: '" + email.getMessageID() + "'.");
                        // signature flag only makes sense locally
                        email.removeSignatureFlag();
                        try {
                            sendEmail(email);
                            fireOutboxListeners(email);
                        } catch (InterruptedException e) {
                            Thread.currentThread().interrupt();
                            throw e;
                        } catch (Exception e) {
                            log.error("Error sending email.", e);
                        }
                    }
                } catch (PasswordException e) {
                    log.debug("Can't scan outbox because a password is set and the application is locked.");
                }
            }
            int pause = configuration.getOutboxCheckInterval();
            wakeupSignal.await(pause, TimeUnit.MINUTES);
        } catch (InterruptedException e) {
            break;
        } catch (RuntimeException e) {
            // catch unexpected exceptions to keep the thread running
            log.error("Exception caught in OutboxProcessor loop", e);
        }
    }
    log.debug("OutboxProcessor thread exiting.");
}
Also used : PasswordException(i2p.bote.fileencryption.PasswordException) Email(i2p.bote.email.Email) CountDownLatch(java.util.concurrent.CountDownLatch) PasswordException(i2p.bote.fileencryption.PasswordException) MessagingException(javax.mail.MessagingException) GeneralSecurityException(java.security.GeneralSecurityException) AddressException(javax.mail.internet.AddressException) IOException(java.io.IOException) DhtException(i2p.bote.network.DhtException)

Aggregations

PasswordException (i2p.bote.fileencryption.PasswordException)26 IOException (java.io.IOException)16 GeneralSecurityException (java.security.GeneralSecurityException)15 MessagingException (javax.mail.MessagingException)11 Email (i2p.bote.email.Email)9 Bitmap (android.graphics.Bitmap)4 View (android.view.View)4 ImageView (android.widget.ImageView)4 TextView (android.widget.TextView)4 Person (i2p.bote.android.util.Person)4 Contact (i2p.bote.packet.dht.Contact)4 Part (javax.mail.Part)4 Intent (android.content.Intent)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 Address (javax.mail.Address)3 InternetAddress (javax.mail.internet.InternetAddress)3 SuppressLint (android.annotation.SuppressLint)2 IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)2 ContentAttachment (i2p.bote.android.util.ContentAttachment)2