aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2013-12-09 11:02:54 (EST)
committerJohn Ross2013-12-09 11:02:54 (EST)
commit4c6549e6614839f60134514c87ed6722b1cf1b3a (patch)
tree3bbc4edd28059f2e8a11a1e65547c748beb8a546
parent657ca124941d2871ac0fc9d0146e1e645d4270ec (diff)
downloadrt.equinox.framework-4c6549e6614839f60134514c87ed6722b1cf1b3a.zip
rt.equinox.framework-4c6549e6614839f60134514c87ed6722b1cf1b3a.tar.gz
rt.equinox.framework-4c6549e6614839f60134514c87ed6722b1cf1b3a.tar.bz2
Bug 423479 - Framework incorrectly disallows osgi.ee requirement in extension bundle
If an extension bundle contains the Require-Capability header, parse the header and throw an exception only if a namespace outside of osgi.ee is encountered. Change error message to include the offending namespace.
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java15
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/messages/ExternalMessages.properties2
2 files changed, 14 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java
index 2f3a39c..0a5e705 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java
@@ -189,8 +189,19 @@ public final class OSGiManifestBuilderFactory {
throw new BundleException(Msg.OSGiManifestBuilderFactory_ExtensionImportError, BundleException.MANIFEST_ERROR);
if (manifest.get(Constants.REQUIRE_BUNDLE) != null)
throw new BundleException(Msg.OSGiManifestBuilderFactory_ExtensionReqBundleError, BundleException.MANIFEST_ERROR);
- if (manifest.get(Constants.REQUIRE_CAPABILITY) != null)
- throw new BundleException(Msg.OSGiManifestBuilderFactory_ExtensionReqCapError, BundleException.MANIFEST_ERROR);
+ if (manifest.get(Constants.REQUIRE_CAPABILITY) != null) {
+ ManifestElement[] manifestElements = ManifestElement.parseHeader(Constants.REQUIRE_CAPABILITY, manifest.get(Constants.REQUIRE_CAPABILITY));
+ if (manifestElements != null) {
+ for (ManifestElement manifestElement : manifestElements) {
+ for (String value : manifestElement.getValueComponents()) {
+ if (!ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE.equals(value)) {
+ throw new BundleException(NLS.bind(Msg.OSGiManifestBuilderFactory_ExtensionReqCapError, value), BundleException.MANIFEST_ERROR);
+ }
+ }
+ }
+ }
+
+ }
if (manifest.get(Constants.BUNDLE_NATIVECODE) != null)
throw new BundleException(Msg.OSGiManifestBuilderFactory_ExtensionNativeError, BundleException.MANIFEST_ERROR);
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/messages/ExternalMessages.properties b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/messages/ExternalMessages.properties
index b9d8b59..ab87322 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/messages/ExternalMessages.properties
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/messages/ExternalMessages.properties
@@ -138,7 +138,7 @@ ModuleResolver_SingletonDisabledError=Could not resolve mandatory modules becaus
OSGiManifestBuilderFactory_ExtensionImportError=Extension bundles cannot import packages.
OSGiManifestBuilderFactory_ExtensionNativeError=Extension bundles cannot have native code.
OSGiManifestBuilderFactory_ExtensionReqBundleError=Extension bundles cannot require bundles.
-OSGiManifestBuilderFactory_ExtensionReqCapError=Extension bundles cannot require capabilities.
+OSGiManifestBuilderFactory_ExtensionReqCapError=Extension bundles cannot require capabilities outside of the osgi.ee namespace: {0}.
OSGiManifestBuilderFactory_InvalidManifestError=Invalid Manifest header "{0}": {1}
SystemModule_LockError=Could not lock the system bundle state for shutdown.