diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/DecryptStreamParser.java b/k9mail/src/main/java/com/fsck/k9/mailstore/DecryptStreamParser.java index d95ab2df0..e38da1ce9 100644 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/DecryptStreamParser.java +++ b/k9mail/src/main/java/com/fsck/k9/mailstore/DecryptStreamParser.java @@ -27,8 +27,8 @@ import org.apache.james.mime4j.stream.MimeConfig; public class DecryptStreamParser { - public static DecryptedBodyPart parse(Part multipartEncrypted, InputStream inputStream) throws MessagingException, IOException { - DecryptedBodyPart decryptedRootPart = new DecryptedBodyPart(multipartEncrypted); + public static DecryptedBodyPart parse(InputStream inputStream) throws MessagingException, IOException { + DecryptedBodyPart decryptedRootPart = new DecryptedBodyPart(); MimeConfig parserConfig = new MimeConfig(); parserConfig.setMaxHeaderLen(-1); @@ -36,7 +36,7 @@ public class DecryptStreamParser { parserConfig.setMaxHeaderCount(-1); MimeStreamParser parser = new MimeStreamParser(parserConfig); - parser.setContentHandler(new PartBuilder(multipartEncrypted, decryptedRootPart)); + parser.setContentHandler(new PartBuilder(decryptedRootPart)); parser.setRecurse(); try { @@ -64,12 +64,10 @@ public class DecryptStreamParser { private static class PartBuilder implements ContentHandler { - private final Part multipartEncrypted; private final DecryptedBodyPart decryptedRootPart; private final Stack stack = new Stack(); - public PartBuilder(Part multipartEncrypted, DecryptedBodyPart decryptedRootPart) throws MessagingException { - this.multipartEncrypted = multipartEncrypted; + public PartBuilder(DecryptedBodyPart decryptedRootPart) throws MessagingException { this.decryptedRootPart = decryptedRootPart; } @@ -80,7 +78,7 @@ public class DecryptStreamParser { } else { Part part = (Part) stack.peek(); - Message innerMessage = new DecryptedMimeMessage(multipartEncrypted); + Message innerMessage = new MimeMessage(); part.setBody(innerMessage); stack.push(innerMessage); @@ -97,7 +95,7 @@ public class DecryptStreamParser { try { Multipart multipart = (Multipart) stack.peek(); - BodyPart bodyPart = new DecryptedBodyPart(multipartEncrypted); + BodyPart bodyPart = new MimeBodyPart(); multipart.addBodyPart(bodyPart); stack.push(bodyPart); @@ -183,18 +181,8 @@ public class DecryptStreamParser { } public static class DecryptedBodyPart extends MimeBodyPart { - private final Part multipartEncrypted; - - public DecryptedBodyPart(Part multipartEncrypted) throws MessagingException { - this.multipartEncrypted = multipartEncrypted; - } - } - - public static class DecryptedMimeMessage extends MimeMessage { - private final Part multipartEncrypted; - - public DecryptedMimeMessage(Part multipartEncrypted) { - this.multipartEncrypted = multipartEncrypted; + public DecryptedBodyPart() throws MessagingException { + // Do nothing } } } diff --git a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java index 8eaab42d3..735eda80f 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageViewFragment.java @@ -71,8 +71,6 @@ import com.fsck.k9.ui.message.DecodeMessageLoader; import com.fsck.k9.ui.message.LocalMessageLoader; import com.fsck.k9.view.MessageHeader; import org.openintents.openpgp.IOpenPgpService; -import org.openintents.openpgp.OpenPgpError; -import org.openintents.openpgp.OpenPgpSignatureResult; import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback; import org.openintents.openpgp.util.OpenPgpServiceConnection; @@ -381,7 +379,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF protected DecryptedBodyPart doInBackground(Void... params) { DecryptedBodyPart decryptedPart = null; try { - decryptedPart = DecryptStreamParser.parse(currentlyDecryptingPart, decryptedInputStream); + decryptedPart = DecryptStreamParser.parse(decryptedInputStream); latch.await(); } catch (InterruptedException e) {