Handle message part errors

pull/147/head
M66B 6 years ago
parent accefedfa5
commit 2fa0b0564b

@ -740,13 +740,14 @@ public class MessageHelper {
Part part; Part part;
} }
MessageParts getMessageParts() throws IOException, MessagingException { MessageParts getMessageParts() throws IOException {
MessageParts parts = new MessageParts(); MessageParts parts = new MessageParts();
getMessageParts(imessage, parts, false); // Can throw ParseException getMessageParts(imessage, parts, false); // Can throw ParseException
return parts; return parts;
} }
private void getMessageParts(Part part, MessageParts parts, boolean pgp) throws MessagingException, IOException { private void getMessageParts(Part part, MessageParts parts, boolean pgp) throws IOException {
try {
if (part.isMimeType("multipart/*")) { if (part.isMimeType("multipart/*")) {
Multipart multipart = (Multipart) part.getContent(); Multipart multipart = (Multipart) part.getContent();
for (int i = 0; i < multipart.getCount(); i++) for (int i = 0; i < multipart.getCount(); i++)
@ -800,6 +801,10 @@ public class MessageHelper {
parts.attachments.add(apart); parts.attachments.add(apart);
} }
} }
} catch (MessagingException ex) {
Log.w(ex);
parts.warnings.add(Helper.formatThrowable(ex));
}
} }
private static String readStream(InputStream is, String charset) throws IOException { private static String readStream(InputStream is, String charset) throws IOException {

Loading…
Cancel
Save