Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
fileinstall-3.2.0
-
None
Description
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()
}
Perhaps a temporary Set is needed within the iteration, so the found bundles can be added to the toRefresh set after the iteration loop?