I am getting java.util.ConcurrentModificationException but I need to figure out which class gives me this exception. The code has numerous classes and packages and it is difficult to figure out where the error comes. The exception shows the problem of ArrayList. It doesn’t catch exeption when I use exception handling in suspected areas.
Any way out?
If you’re using a modern IDE, eclipse for example, then you can run the application in debug mode and set a breakpoint on any Exception. With the effect: the application will stop each time the exception is thrown (in the entire JVM) and you get a stack trace.
That makes it quite easy to identify the caller (and the actual thread, if it is a concurrency issue)
That’s the bad guy. It’s the
paintmethod yourJavaGroupLayerclass. It probably has a for loop that iterates through an array list and at one point it detects, that the list has been modified.Do you use threads in your swing application? In that case, double check that they do not modify the layout.