diff options
author | Thomas Watson | 2012-08-03 14:10:03 +0000 |
---|---|---|
committer | Thomas Watson | 2012-08-03 14:30:31 +0000 |
commit | 45be052ceddbd7fa47e1a6f477fa50dd587481d9 (patch) | |
tree | 3aa13024b4c462c0357d7037bdcb7d5cb28ea256 /bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container | |
parent | 8d588f93dd29153ef3ccdc57d745e542d4b03368 (diff) | |
download | rt.equinox.framework-45be052ceddbd7fa47e1a6f477fa50dd587481d9.tar.gz rt.equinox.framework-45be052ceddbd7fa47e1a6f477fa50dd587481d9.tar.xz rt.equinox.framework-45be052ceddbd7fa47e1a6f477fa50dd587481d9.zip |
check for mandatory attars needs to be more flexible because of version ranges.
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container')
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java index 4173fcb98..a393fdb01 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java @@ -10,10 +10,11 @@ *******************************************************************************/ package org.eclipse.osgi.internal.container; -import org.eclipse.osgi.internal.framework.FilterImpl; - import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.eclipse.osgi.container.*; +import org.eclipse.osgi.internal.framework.FilterImpl; import org.eclipse.osgi.util.ManifestElement; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.namespace.*; @@ -21,6 +22,7 @@ import org.osgi.resource.Capability; import org.osgi.resource.Namespace; public class Capabilities { + public static final Pattern MANDATORY_ATTR = Pattern.compile("\\(([^(=<>]+)\\s*[=<>]\\s*[^)]+\\)"); static class NamespaceSet { private final String name; @@ -175,10 +177,21 @@ public class Capabilities { if (f == null) { return false; } + Matcher matcher = MANDATORY_ATTR.matcher(f.toString()); String[] mandatoryAttrs = ManifestElement.getArrayFromList(mandatory, ","); //$NON-NLS-1$ boolean allPresent = true; - for (String attribute : mandatoryAttrs) { - allPresent &= f.getPrimaryKeyValue(attribute) != null; + for (String mandatoryAttr : mandatoryAttrs) { + matcher.reset(); + boolean found = false; + while (matcher.find()) { + int numGroups = matcher.groupCount(); + for (int i = 1; i <= numGroups; i++) { + if (mandatoryAttr.equals(matcher.group(i))) { + found = true; + } + } + } + allPresent &= found; } return allPresent; } |