ConcurrentModificationException in
DirectoryWatcher.findBundlesWithFragmentsToRefresh
-------------------------------------------------------------------------------------
Key: FELIX-3416
URL: https://issues.apache.org/jira/browse/FELIX-3416
Project: Felix
Issue Type: Bug
Components: File Install
Affects Versions: fileinstall-3.2.0
Reporter: Matt Magoffin
I recently upgraded to File Install 3.2.0, and while testing an application
came across this exception:
In main loop, we have serious trouble: java.util.ConcurrentModificationException
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
at java.util.HashMap$KeyIterator.next(HashMap.java:828)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.findBundlesWithFragmentsToRefresh(DirectoryWatcher.java:1247)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:475)
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:286)
Looking at the code, in the findBundlesWithFragmentsToRefresh() method, I see
it iterates over a set while adding to the set, which violates the contract of
the java.util.HashSet instance passed into the method:
protected void findBundlesWithFragmentsToRefresh(Set toRefresh) {
for (Iterator iterator = toRefresh.iterator(); iterator.hasNext();) {
...
toRefresh.add(hostBundle);
}
}
Perhaps a temporary Set is needed within the iteration, so the found bundles
can be added to the toRefresh set after the iteration loop?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira