Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/106#discussion_r59563955
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java
 ---
    @@ -155,9 +181,42 @@ public void removedBundle(Bundle bundle, BundleEvent 
bundleEvent, Iterable<? ext
                     LOG.debug("No BOM found in {} {} {}", bundleIds(bundle));
                 }
     
    +            if (!passesWhiteAndBlacklists(bundle)) {
    +                removeAnyApplications(catalogItems);
    +            }
    +
                 return catalogItems;
             }
     
    +        private void removeAnyApplications(Iterable<? extends 
CatalogItem<?, ?>> catalogItems) {
    +
    +            final Iterator<? extends CatalogItem<?, ?>> cit = 
catalogItems.iterator();
    +            while (cit.hasNext()) {
    +                final CatalogItem<?, ?> item = cit.next();
    +                if (TEMPLATE.equals(item.getCatalogItemType())) {
    +                    removeFromCatalog(item);
    +                    cit.remove();
    --- End diff --
    
    This method modifies its argument, which is ultimately used as a return 
value for addingBundle, which becomes the set of items that is tracked by the 
BundleTracker, so if I remove something from the catalog in here, I also need 
to remove it from the iterable.  This probably this isn't clear enough from the 
code as written, so I shall change this to return a new Iterable rather than 
modify the arg.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to