Modify extension bundle parsing to assume "framework" is the default value
for the extension directive on extension bundle Fragment-Host headers. (FELIX-4355)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1559832 13f79535-47bb-0310-9956-ffa450edef68
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 1742c02..a067dbb 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
@@ -1547,25 +1547,24 @@
 
         if (clauses.size() == 1)
         {
-            // See if there is the "extension" directive.
             for (Entry<String, String> entry : clauses.get(0).m_dirs.entrySet())
             {
                 if (Constants.EXTENSION_DIRECTIVE.equals(entry.getKey()))
                 {
-                    // If the extension directive is specified, make sure
-                    // the target is the system bundle.
-                    if (FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(clauses.get(0).m_paths.get(0)) ||
-                        Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(clauses.get(0).m_paths.get(0)))
-                    {
-                        return entry.getValue();
-                    }
-                    else
-                    {
-                        throw new BundleException(
-                            "Only the system bundle can have extension bundles.");
-                    }
+                    result = entry.getValue();
                 }
             }
+
+            if (FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(clauses.get(0).m_paths.get(0)) ||
+                Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(clauses.get(0).m_paths.get(0)))
+            {
+                result = (result == null) ? Constants.EXTENSION_FRAMEWORK : result;
+            }
+            else if (result != null)
+            {
+                throw new BundleException(
+                    "Only the system bundle can have extension bundles.");
+            }
         }
 
         return result;