question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MapDotKeyReplacer throws an ConcurrentModificationException

See original GitHub issue

MapKeyDotReplacer throws an ConcurrentModificationException when tries to replace dots in the document Map. I would suggest to rewrite the method replaceInMapKeys in the MapKeyDotReplacer class as follows:

private Document replaceInMapKeys(Document map, String regexFrom, String from, String to) {
    Document result = new Document();
    for (String key : map.keySet()) {
        Object val = map.get(key);
        if (key.contains(from)) {
            String escaped = key.replaceAll(regexFrom, to);
            result.put(escaped, val);
        } else {
           result.put(key, val);
        }
    }
    return result;
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bartoszwalacikcommented, Nov 11, 2019

fix is released in 5.8.5 @luca010 thanks for your contribution, well done

0reactions
bartoszwalacikcommented, Nov 7, 2019

ok, please create the pull request from your fork to javers master

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is a ConcurrentModificationException thrown and how to ...
This will throw a ConcurrentModificationException when the it.hasNext() is called the second time. The correct approach would be. Iterator it = ...
Read more >
java.util.ConcurrentModificationException - DigitalOcean
From the output stack trace, it's clear that the concurrent modification exception is thrown when we call iterator next() function.
Read more >
How to Avoid the Concurrent Modification Exception in Java
The ConcurrentModificationException in Java occurs when an object is attempted to be modified concurrently without permission.
Read more >
Fix the ConcurrentModificationException | TechTarget
Java's ConcurrentModificationException is thrown when a collection is modified while a Java Iterator is trying to loop through it.
Read more >
Avoiding the ConcurrentModificationException in Java
@Test(expected = ConcurrentModificationException.class) public void whilstRemovingDuringIteration_shouldThrowException() throws ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found