aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1162856 - /aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolverHook.java
Date Mon, 29 Aug 2011 15:21:18 GMT
Author: jwross
Date: Mon Aug 29 15:21:18 2011
New Revision: 1162856

URL: http://svn.apache.org/viewvc?rev=1162856&view=rev
Log:
ARIES-738: [subsystems] The subsystem resolver hook modifies a collection it's iterating over.

Changed the for:each loop into a for loop using an Iterator. The Iterator.remove method is
then used to remove candidates when necessary.

Modified:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolverHook.java

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolverHook.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolverHook.java?rev=1162856&r1=1162855&r2=1162856&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolverHook.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/SubsystemResolverHook.java
Mon Aug 29 15:21:18 2011
@@ -15,12 +15,12 @@ package org.apache.aries.subsystem.core.
 
 import java.util.Collection;
 import java.util.EnumSet;
+import java.util.Iterator;
 
 import org.osgi.framework.hooks.resolver.ResolverHook;
 import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleRequirement;
 import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.Resource;
 import org.osgi.service.subsystem.Subsystem;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -38,8 +38,8 @@ public class SubsystemResolverHook imple
 
 	public void filterResolvable(Collection<BundleRevision> candidates) {
 		try {
-			for (Resource candidate : candidates) {
-				Collection<AriesSubsystem> subsystems = AriesSubsystem.getSubsystems(candidate);
+			for (Iterator<BundleRevision> iterator = candidates.iterator(); iterator.hasNext();)
{
+				Collection<AriesSubsystem> subsystems = AriesSubsystem.getSubsystems(iterator.next());
 				for (AriesSubsystem subsystem : subsystems) {
 					if (subsystem.isFeature()) {
 						// Feature subsystems require no isolation.
@@ -48,7 +48,7 @@ public class SubsystemResolverHook imple
 					// Otherwise, the candidate is part of an application or composite subsystem requiring
isolation.
 					// But only when in the INSTALLING or INSTALLED state.
 					if (EnumSet.of(Subsystem.State.INSTALLING, Subsystem.State.INSTALLED).contains(subsystem.getState()))
{
-						candidates.remove(candidate);
+						iterator.remove();
 					}
 				}
 			}



Mime
View raw message