Skip to content

ConcurrentModificationException when importing from MimeMessage #202

Closed

Description

@nedashley

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

Activity

  1. nedashley commented on Apr 13, 2019

    @nedashley
    Author

    Hi,

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

    Thanks
    Ned

  2. bbottema commented on Apr 24, 2019

    @bbottema
    Owner

    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.

  3. self-assigned this
    on Apr 24, 2019
  4. added this to the 5.1.5 milestone on Apr 24, 2019
  5. added a commit that references this issue on Apr 24, 2019
  6. bbottema commented on Apr 24, 2019

    @bbottema
    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions