You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2008/08/29 16:49:25 UTC
svn commit: r690277 - in
/felix/trunk/framework/src/main/java/org/apache/felix/framework: Felix.java
util/manifestparser/ManifestParser.java
Author: rickhall
Date: Fri Aug 29 07:49:25 2008
New Revision: 690277
URL: http://svn.apache.org/viewvc?rev=690277&view=rev
Log:
Throw an exception when installing a fragment that uses features that we
do not support.
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=690277&r1=690276&r2=690277&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Fri Aug 29 07:49:25 2008
@@ -2336,8 +2336,6 @@
verifyExecutionEnvironment(bundle);
- checkFragment(bundle);
-
addSecurity(bundle);
if (!bundle.getInfo().isExtension())
@@ -2472,21 +2470,6 @@
}
/**
- * Checks whether bundle is a fragment bundle, and if so, logs a warning as fragment bundles
- * are not yet supported by Felix.
- * @param bundle The bundle to verify
- **/
- private void checkFragment(FelixBundle bundle)
- {
- String fragmentHost = (String) bundle.getInfo().getCurrentHeader().get(Constants.FRAGMENT_HOST);
- if (fragmentHost != null)
- {
- m_logger.log(Logger.LOG_WARNING, "Bundle " + bundle.getBundleId()
- + " is a fragment bundle; fragment are only partially supported!");
- }
- }
-
- /**
* Check the required bundle execution environment against the framework provided
* exectution environment.
* @param bundleEnvironment The required execution environment string
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java?rev=690277&r1=690276&r2=690277&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java Fri Aug 29 07:49:25 2008
@@ -97,6 +97,7 @@
(String) headerMap.get(Constants.FRAGMENT_HOST));
if (clauses.length > 0)
{
+ validateFragment(headerMap);
try
{
reqList.add(
@@ -239,6 +240,27 @@
}
}
+ /**
+ * Checks whether a fragment uses features that we do not currently support
+ * (e.g., Import-Package, Export-Package, and Bundle-NativeCode). If so, we
+ * throw an exception.
+ * @param headerMap the header to validate.
+ **/
+ private void validateFragment(Map headerMap) throws BundleException
+ {
+ String fragmentHost = (String) headerMap.get(Constants.FRAGMENT_HOST);
+ if (fragmentHost != null)
+ {
+ if ((headerMap.get(Constants.IMPORT_PACKAGE) != null)
+ || (headerMap.get(Constants.EXPORT_PACKAGE) != null)
+ || (headerMap.get(Constants.BUNDLE_NATIVECODE) != null))
+ {
+ throw new BundleException(
+ "Fragments with exports, imports, or native code are not currently supported.");
+ }
+ }
+ }
+
public String getManifestVersion()
{
String manifestVersion = (String) m_headerMap.get(Constants.BUNDLE_MANIFESTVERSION);