Github user tbouron commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/856#discussion_r143132340
--- Diff:
core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
---
@@ -103,8 +103,8 @@ private TemporaryInternalScanResult
scanForCatalogInternal(Bundle bundle, boolea
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.containsAll(result.mapOfNewToReplaced.keySet()) &&
result.mapOfNewToReplaced.keySet().containsAll(matches))) {
- // sanity check
+ if (matches.size()!=result.mapOfNewToReplaced.size()) {
--- End diff --
I'm afraid this will be too loose: the 2 sets have the same size but we
don't know if the items are "the same", i.e. same `symbolicName` and `version`.
Could we have a middle ground here? Something like looping over each items
in `result.mapOfNewToReplaced`, checking if `matches` contains one with the
same `symbolicName` and `version`. Those fields should be resolved and would
provide sufficient equality in this case. WDYT?
---