You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2015/03/17 07:59:38 UTC

[jira] [Closed] (FELIX-3416) ConcurrentModificationException in DirectoryWatcher.findBundlesWithFragmentsToRefresh

     [ https://issues.apache.org/jira/browse/FELIX-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler closed FELIX-3416.
-----------------------------------

> 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
>            Assignee: Guillaume Nodet
>             Fix For: fileinstall-3.2.4
>
>
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)