diff options
Diffstat (limited to 'bundles/org.eclipse.osgi/resolver/src')
3 files changed, 13 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java index 6db82f4d0..c84bf88cc 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java @@ -100,6 +100,8 @@ class StateBuilder { checkImportExportSyntax(elements, false, jreBundle); if (DEFINED_OSGI_VALIDATE_HEADERS[i] == Constants.EXPORT_PACKAGE) checkImportExportSyntax(elements, true, jreBundle); + if (DEFINED_OSGI_VALIDATE_HEADERS[i] == Constants.FRAGMENT_HOST) + checkExtensionBundle(elements); } else if (DEFINED_OSGI_VALIDATE_HEADERS[i] == Constants.BUNDLE_SYMBOLICNAME) { throw new BundleException(NLS.bind(StateMsg.HEADER_REQUIRED, Constants.BUNDLE_SYMBOLICNAME)); } @@ -348,4 +350,13 @@ class StateBuilder { if (elements[i].getDirective(Constants.USES_DIRECTIVE) != null) throw new BundleException(NLS.bind(StateMsg.HEADER_REEXPORT_USES, Constants.USES_DIRECTIVE, Constants.REEXPORT_PACKAGE)); } + + + private static void checkExtensionBundle(ManifestElement[] elements) throws BundleException { + if (elements.length == 0 || elements[0].getDirective(Constants.EXTENSION_DIRECTIVE) == null) + return; + String hostName = elements[0].getValue(); + if (!hostName.equals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME) && !hostName.equals(Constants.getInternalSymbolicName())) + throw new BundleException(NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName)); + } } diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMessages.properties b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMessages.properties index 53a71d9be..16629f1b4 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMessages.properties +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMessages.properties @@ -19,6 +19,7 @@ HEADER_VERSION_ERROR=The attributes \"{0}\" and \"{1}\" must match HEADER_EXPORT_ATTR_ERROR=Specifying \"{0}\" in the \"{1}\" header is not permitted HEADER_DIRECTIVE_DUPLICATES=Duplicate directives are not permitted HEADER_REEXPORT_USES=Cannot specify the \"{0}\" directive on the header \"{1}\" +HEADER_EXTENSION_ERROR=Extension bundle is not a fragment to the system bundle \"{0}\" RES_ERROR_MISSING_PERMISSION=Missing Permission: {0} RES_ERROR_MISSING_CONSTRAINT=Missing Constraint: {0} diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java index 059cd75a4..b67b81286 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java @@ -23,6 +23,7 @@ public class StateMsg extends NLS { public static String HEADER_EXPORT_ATTR_ERROR; public static String HEADER_DIRECTIVE_DUPLICATES; public static String HEADER_REEXPORT_USES; + public static String HEADER_EXTENSION_ERROR; public static String RES_ERROR_MISSING_PERMISSION; public static String RES_ERROR_MISSING_CONSTRAINT; |