Author: jwross
Date: Wed Apr 13 18:51:20 2016
New Revision: 1738986

URL: http://svn.apache.org/viewvc?rev=1738986&view=rev
Log:
[ARIES-1523] Application with fragment in archive and host in OBR will fail to 
resolve.

If both the provider and requirer of a capability are content of the same 
subsystem, then the capability will be visible.

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

Modified: 
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java?rev=1738986&r1=1738985&r2=1738986&view=diff
==============================================================================
--- 
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
 (original)
+++ 
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
 Wed Apr 13 18:51:20 2016
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.aries.subsystem.core.archive.ProvisionPolicyDirective;
+import org.apache.aries.subsystem.core.archive.SubsystemContentHeader;
 import org.apache.aries.subsystem.core.archive.SubsystemManifest;
 import org.apache.aries.subsystem.core.archive.SubsystemTypeHeader;
 import 
org.apache.aries.subsystem.core.internal.BundleResourceInstaller.BundleConstituent;
@@ -338,8 +339,17 @@ public class ResolveContext extends org.
        private boolean isValid(Capability capability, Requirement requirement) 
throws BundleException, IOException, InvalidSyntaxException, URISyntaxException 
{
                if 
(IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getNamespace()))
                        return true;
-               Region from = 
findRegionForCapabilityValidation(capability.getResource());
-               Region to = 
findRegionForCapabilityValidation(requirement.getResource());
+               Resource provider = capability.getResource();
+               Resource requirer = requirement.getResource();
+               SubsystemManifest manifest = resource.getSubsystemManifest();
+               SubsystemContentHeader header = 
manifest.getSubsystemContentHeader();
+               if (header.contains(provider) && header.contains(requirer)) {
+                       // Shortcut. If both the provider and requirer are 
content then they
+                       // are in the same region and the capability will be 
visible.
+                       return true;
+               }
+               Region from = findRegionForCapabilityValidation(provider);
+               Region to = findRegionForCapabilityValidation(requirer);
                return new SharingPolicyValidator(from, to).isValid(capability);
        }
        


Reply via email to