Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentModificationException when importing from MimeMessage #202

Closed
nedashley opened this issue Apr 13, 2019 · 3 comments
Closed

ConcurrentModificationException when importing from MimeMessage #202

nedashley opened this issue Apr 13, 2019 · 3 comments
Assignees
Milestone

Comments

@nedashley
Copy link

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

@nedashley
Copy link
Author

Hi,

I can confirm that after making the above change my use case is now working and not experiencing the ConcurrentModificationException.

Thanks
Ned

@bbottema
Copy link
Owner

bbottema commented Apr 24, 2019

I think you were checking the develop folder (not released in a version), while the bug is already in the master folder (released in recent versions).

I'm going to backport your change into the master and release it in v5.1.5.

@bbottema bbottema self-assigned this Apr 24, 2019
@bbottema bbottema added this to the 5.1.5 milestone Apr 24, 2019
bbottema added a commit that referenced this issue Apr 24, 2019
…edded images to regular attachments list (big thanks to @nedashley!)
@bbottema
Copy link
Owner

Done, released in 5.1.5! Thanks for the bug report!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants