[ https://issues.apache.org/jira/browse/FELIX-4609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14118233#comment-14118233 ]
Andre Flakowski edited comment on FELIX-4609 at 9/2/14 2:30 PM: ---------------------------------------------------------------- I reproduced the problem under Karaf 2.3.6 as well. I traced it back to the same Issue: The problem is the removal of a config file in line 83 (changed.remove(file)) which causes the HashMap to throw the ConcurrentModificationException. was (Author: apf): I reproduced the problem under Karaf 2.3.6 as well. I traced it back to the same Issue: The problem is the removal of a config file in line 83 (changed.remove(file);) which causes the HashMap to throw the ConcurrentModificationException. > Possible ConcurrentModificationException in WatcherScanner > ---------------------------------------------------------- > > Key: FELIX-4609 > URL: https://issues.apache.org/jira/browse/FELIX-4609 > Project: Felix > Issue Type: Bug > Components: File Install > Affects Versions: fileinstall-3.4.0 > Reporter: Daniel Kulp > > In some cases at startup, I'm getting: > {code} > 12:02:06,941 | ERROR | OT/container/etc | ? > ? | 6 - org.apache.felix.fileinstall - 3.4.0 | In main loop, we have serious > trouble > java.util.ConcurrentModificationException > at java.util.HashMap$HashIterator.nextEntry(HashMap.java:922)[:1.7.0_67] > at java.util.HashMap$KeyIterator.next(HashMap.java:956)[:1.7.0_67] > at > org.apache.felix.fileinstall.internal.WatcherScanner.scan(WatcherScanner.java:70)[6:org.apache.felix.fileinstall:3.4.0] > at > org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:305)[6:org.apache.felix.fileinstall:3.4.0] > {code} > The problem looks to stem from line 83 of WatcherScanner. The "changed" > HashSet is being modified (remove call) within the for loop that is iterating > over it. > Most likely, a small change of: > {code} > Index: WatcherScanner.java > =================================================================== > --- WatcherScanner.java (revision 1619096) > +++ WatcherScanner.java (working copy) > @@ -78,10 +78,8 @@ > if ((newChecksum == lastChecksum || reportImmediately)) { > if (newChecksum != storedChecksum) { > storedChecksums.put(file, newChecksum); > - files.add(file); > - } else { > - changed.remove(file); > } > + files.add(file); > if (reportImmediately) { > removed.remove(file); > } > {code} > will fix it, but untested at this point. -- This message was sent by Atlassian JIRA (v6.3.4#6332)