|
|
|
@ -3806,8 +3806,11 @@ public class MessageHelper {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
throw new MessagingStructureException(content, "multipart/mixed");
|
|
|
|
|
} else {
|
|
|
|
|
String msg = "Expected multipart/mixed got " + content.getClass().getName();
|
|
|
|
|
Log.e(msg);
|
|
|
|
|
parts.warnings.add(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (part.isMimeType("multipart/signed")) {
|
|
|
|
@ -3851,8 +3854,11 @@ public class MessageHelper {
|
|
|
|
|
sb.append(' ').append(i).append('=').append(multipart.getBodyPart(i).getContentType());
|
|
|
|
|
Log.e(sb.toString());
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
throw new MessagingStructureException(content, "multipart/signed");
|
|
|
|
|
} else {
|
|
|
|
|
String msg = "Expected multipart/signed got " + content.getClass().getName();
|
|
|
|
|
Log.e(msg);
|
|
|
|
|
parts.warnings.add(msg);
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
Log.e(ct.toString());
|
|
|
|
|
} else if (part.isMimeType("multipart/encrypted")) {
|
|
|
|
@ -3873,8 +3879,12 @@ public class MessageHelper {
|
|
|
|
|
sb.append(' ').append(i).append('=').append(multipart.getBodyPart(i).getContentType());
|
|
|
|
|
Log.e(sb.toString());
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
throw new MessagingStructureException(content, "multipart/encrypted");
|
|
|
|
|
} else {
|
|
|
|
|
String msg = "Expected multipart/encrypted got " + content.getClass().getName();
|
|
|
|
|
Log.e(msg);
|
|
|
|
|
parts.warnings.add(msg);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
Log.e(ct.toString());
|
|
|
|
|
} else if (part.isMimeType("application/pkcs7-mime") ||
|
|
|
|
@ -3954,11 +3964,8 @@ public class MessageHelper {
|
|
|
|
|
if (part.isMimeType("multipart/*")) {
|
|
|
|
|
Multipart multipart;
|
|
|
|
|
Object content = part.getContent(); // Should always be Multipart
|
|
|
|
|
if (content instanceof Multipart)
|
|
|
|
|
if (content instanceof Multipart) {
|
|
|
|
|
multipart = (Multipart) part.getContent();
|
|
|
|
|
else
|
|
|
|
|
throw new MessagingStructureException(content, "multipart/*");
|
|
|
|
|
|
|
|
|
|
int count = multipart.getCount();
|
|
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
|
try {
|
|
|
|
@ -3970,7 +3977,14 @@ public class MessageHelper {
|
|
|
|
|
Log.w(ex);
|
|
|
|
|
parts.warnings.add(Log.formatThrowable(ex, false));
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
String msg = "Expected multipart/* got " + content.getClass().getName();
|
|
|
|
|
Log.e(msg);
|
|
|
|
|
parts.warnings.add(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// https://www.iana.org/assignments/cont-disp/cont-disp.xhtml
|
|
|
|
|
String disposition;
|
|
|
|
|
try {
|
|
|
|
@ -4093,7 +4107,6 @@ public class MessageHelper {
|
|
|
|
|
|
|
|
|
|
parts.attachments.add(apart);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (FolderClosedException ex) {
|
|
|
|
|
throw ex;
|
|
|
|
|
} catch (MessagingException ex) {
|
|
|
|
@ -4435,24 +4448,6 @@ public class MessageHelper {
|
|
|
|
|
return values;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static class MessagingStructureException extends MessagingException {
|
|
|
|
|
private String className;
|
|
|
|
|
private String expected;
|
|
|
|
|
|
|
|
|
|
MessagingStructureException(Object content, String expected) {
|
|
|
|
|
super();
|
|
|
|
|
if (content != null)
|
|
|
|
|
this.className = content.getClass().getName();
|
|
|
|
|
this.expected = expected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
|
@Override
|
|
|
|
|
public String getMessage() {
|
|
|
|
|
return className + " expected: " + expected;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static class Report {
|
|
|
|
|
String type;
|
|
|
|
|
String reporter;
|
|
|
|
|