Closed
Description
Hi,
I am experiencing a ConcurrentModificationException when converting from MimeMessage. I have narrowed the cause down to the moveInvalidEmbeddedResourcesToAttachments method in MimeMessageParser.
Here is a fix which I am currently testing:
private static void moveInvalidEmbeddedResourcesToAttachments(ParsedMimeMessageComponents parsedComponents) {
final String htmlContent = parsedComponents.htmlContent.toString();
for(Iterator<Map.Entry<String, DataSource>> it = parsedComponents.cidMap.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<String, DataSource> entry = it.next();
String cid = extractCID(entry.getKey());
if (!htmlContent.contains("cid:" + cid)) {
parsedComponents.attachmentList.put(cid, entry.getValue());
it.remove();
}
}
}
Thanks
Ned