You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2019/04/17 04:14:24 UTC

[karaf] branch master updated: [KARAF-6239] Workaround (waiting Felix Utils fix release) to avoid duplicated of features to deploy

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 80ed427  [KARAF-6239] Workaround (waiting Felix Utils fix release) to avoid duplicated of features to deploy
     new 87f4972  Merge pull request #815 from jbonofre/KARAF-6239
80ed427 is described below

commit 80ed427f0429ac8bf92229ea62c26e57ca4537a1
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Tue Apr 16 15:32:13 2019 +0200

    [KARAF-6239] Workaround (waiting Felix Utils fix release) to avoid duplicated of features to deploy
---
 .../org/apache/karaf/features/internal/service/Deployer.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
index f2eb18f..c33e272 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
@@ -1342,8 +1342,14 @@ public class Deployer {
 
             // Compute the list of resources to deploy in the region
             Set<Resource> bundlesInRegion = bundlesPerRegions.get(region);
-            List<Resource> toDeploy = bundlesInRegion != null
-                    ? new ArrayList<>(bundlesInRegion) : new ArrayList<>();
+            // **********************************************************************
+            // KARAF-6239: workaround to avoid several entries for the same resource
+            Map<String, Resource> deduplicatedMap = new HashMap<>();
+            for (Resource resource : bundlesInRegion) {
+                deduplicatedMap.put(getSymbolicName(resource) + "/" + getVersion(resource), resource);
+            }
+            List<Resource> toDeploy = new ArrayList<>(deduplicatedMap.values());
+            // **********************************************************************
 
             // Remove the system bundle
             Bundle systemBundle = dstate.bundles.get(0l);