fix discrepancy check when loading bundles

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/6ee291c7
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/6ee291c7
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/6ee291c7

Branch: refs/heads/master
Commit: 6ee291c7b736872856c6e8b43be56f95dc1fcff6
Parents: 8cd5465
Author: Alex Heneveld <[email protected]>
Authored: Thu Aug 24 10:00:26 2017 +0100
Committer: Alex Heneveld <[email protected]>
Committed: Thu Aug 24 10:00:26 2017 +0100

----------------------------------------------------------------------
 .../brooklyn/core/catalog/internal/CatalogBundleLoader.java     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6ee291c7/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
 
b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
index f690df0..4e18b09 100644
--- 
a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
+++ 
b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
@@ -103,10 +103,11 @@ public class CatalogBundleLoader {
                 
this.managementContext.getCatalog().addTypesFromBundleBom(bomText, mb, force, 
result.mapOfNewToReplaced);
                 if (validate) {
                     Set<RegisteredType> matches = 
MutableSet.copyOf(this.managementContext.getTypeRegistry().getMatching(RegisteredTypePredicates.containingBundle(mb.getVersionedName())));
-                    if (!matches.equals(result.mapOfNewToReplaced.keySet())) {
+                    if 
(!(matches.containsAll(result.mapOfNewToReplaced.keySet()) && 
result.mapOfNewToReplaced.keySet().containsAll(matches))) {
                         // sanity check
                         LOG.warn("Discrepancy in list of Brooklyn items found 
for "+mb.getVersionedName()+": "+
-                            "installer said "+result.mapOfNewToReplaced+" but 
registry looking found "+matches);
+                            "installer said 
"+result.mapOfNewToReplaced.keySet()+" 
("+result.mapOfNewToReplaced.keySet().size()+") "+
+                            "but registry search found "+matches+" 
("+matches.size()+")");
                     }
                     Map<RegisteredType, Collection<Throwable>> 
validationErrors = this.managementContext.getCatalog().validateTypes( matches );
                     if (!validationErrors.isEmpty()) {

Reply via email to