Don't try to install extension bundles as fragments because they are different. Furthermore, fail to install extension bundles if they have incomplete metadata (FELIX-770).
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@706792 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
index f736097..f5da891 100644
--- a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
+++ b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
@@ -245,12 +245,8 @@
*/
boolean isExtensionBundle(Map headers)
{
- R4Directive dir = ManifestParser.parseExtensionBundleHeader((String)
- headers.get(Constants.FRAGMENT_HOST));
-
- return (dir != null) && (Constants.EXTENSION_FRAMEWORK.equals(
- dir.getValue()) || Constants.EXTENSION_BOOTCLASSPATH.equals(
- dir.getValue()));
+ return (ManifestParser.parseExtensionBundleHeader((String)
+ headers.get(Constants.FRAGMENT_HOST)) != null);
}
/**
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
index 999930f..78d94fb 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
@@ -252,7 +252,7 @@
// fragment constants in FelixConstants when fragments are
// fully implemented.
String fragmentHost = (String) headerMap.get(Constants.FRAGMENT_HOST);
- if (fragmentHost != null)
+ if ((fragmentHost != null) && (parseExtensionBundleHeader(fragmentHost) == null))
{
if ((headerMap.get(Constants.IMPORT_PACKAGE) != null)
|| (headerMap.get(Constants.EXPORT_PACKAGE) != null)
@@ -763,9 +763,17 @@
}
}
- if (parseExtensionBundleHeader((String)
- m_headerMap.get(Constants.FRAGMENT_HOST)) != null)
+ R4Directive extension = parseExtensionBundleHeader((String)
+ m_headerMap.get(Constants.FRAGMENT_HOST));
+
+ if (extension != null)
{
+ if (!(Constants.EXTENSION_FRAMEWORK.equals(extension.getValue()) ||
+ Constants.EXTENSION_BOOTCLASSPATH.equals(extension.getValue())))
+ {
+ throw new BundleException(
+ "Extension bundle must have either 'extension:=framework' or 'extension:=bootclasspath'");
+ }
checkExtensionBundle();
}
}