[ 
https://issues.apache.org/jira/browse/ARTEMIS-1411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16164378#comment-16164378
 ] 

Jiri Danek commented on ARTEMIS-1411:
-------------------------------------

In theory, all uses of the custom {{ConcurrentHashSet}} could be replaced with 
newSetFromMap, maybe. Probably not worth it.

https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#newSetFromMap-java.util.Map-

> Coverity: Using invalid iterator in ProcessBuilder.java
> -------------------------------------------------------
>
>                 Key: ARTEMIS-1411
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1411
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.4.0
>            Reporter: Jiri Danek
>            Priority: Minor
>
> {noformat}
>  48   public static void cleanupProcess() {
>       1. enhanced_for: Starting an iteration on 
> org.apache.activemq.artemis.cli.process.ProcessBuilder.processes.
>       2. Iterating over another element of 
> org.apache.activemq.artemis.cli.process.ProcessBuilder.processes.
>       
> CID 1409570 (#1 of 1): Using invalid iterator (INVALIDATE_ITERATOR)
> 5. invalid_loop: Attempting to obtain another element from 
> org.apache.activemq.artemis.cli.process.ProcessBuilder.processes after it's 
> been modified.
>  49      for (Process p : processes) {
>  50         //         if (!p.isAlive())
>  51         {
>       3. modify_iterable: Call to remove modifies Iterable 
> org.apache.activemq.artemis.cli.process.ProcessBuilder.processes which 
> invalidates the iterator for the loop on that Iterable. [Note: The source 
> code implementation of the function has been overridden by a builtin model.]
>  52            processes.remove(p);
>  53         }
>       4. Jumping back to the beginning of the loop.
>  54      }
>  55   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to