Implement support for allowing duplicate BSN/version pairs. (FELIX-3124)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1173329 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
index 4d2e009..e89f727 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
@@ -1198,8 +1198,15 @@
             headerMap,
             m_archive.getCurrentRevision().getContent());
 
-        // Verify that the bundle symbolic name + version is unique.
-        if (revision.getManifestVersion().equals("2"))
+        // For R4 bundles, verify that the bundle symbolic name + version
+        // is unique unless this check has been disabled.
+        String allowMultiple =
+            (String) getFramework().getConfig().get(Constants.FRAMEWORK_BSNVERSION);
+        allowMultiple = (allowMultiple == null)
+            ? Constants.FRAMEWORK_BSNVERSION_SINGLE
+            : allowMultiple;
+        if (revision.getManifestVersion().equals("2")
+            && !allowMultiple.equals(Constants.FRAMEWORK_BSNVERSION_MULTIPLE))
         {
             Version bundleVersion = revision.getVersion();
             bundleVersion = (bundleVersion == null) ? Version.emptyVersion : bundleVersion;