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.

ConcurrentModificationException while getting ScanResult output

See original GitHub issue

Sometimes this happens:

java.util.ConcurrentModificationException
 	at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:937)
 	at java.base/java.util.ArrayList$Itr.next(ArrayList.java:891)
 	at io.github.classgraph.ScanResult.getResourcesMatchingPattern(ScanResult.java:383)

My call looks innocent enough:

val configUrls = new ClassGraph().scan()
    .getResourcesMatchingPattern(configRegex.r.pattern)
    .asScala
    .map(_.getURL)

Is it possible to fix it?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:45 (27 by maintainers)

github_iconTop GitHub Comments

1reaction
pshirshovcommented, Oct 11, 2018

Eh, I’ve uncovered a pandora’s box. My world will never be the same.

Though the conclusion is simple: we must never use finalizers except of situations when our app is completely independent of when they may be executed and if they may be executed. Crap-crap-crap.

0reactions
GedMarccommented, Oct 11, 2018

that is a good read

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
ConcurrentModificationException - Android Developers
In general, the results of the iteration are undefined under these circumstances. Some Iterator implementations (including those of all the general purpose ...
Read more >
How to avoid java.util.ConcurrentModificationException when ...
The above code, through iterator we can remove the "def" name from the Arraylist and try to print the array, you would be...
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/Fix ConcurrentModificationException ... - Java67
Solving ConcurrentModificationException while Iterating over ArrayList in Java. Here is the Java program to demonstrate one scenario where you get the ...
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