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

    https://github.com/apache/incubator-brooklyn/pull/617#discussion_r30583877
  
    --- Diff: 
core/src/main/java/brooklyn/management/internal/AbstractManagementContext.java 
---
    @@ -443,6 +441,22 @@ public void setManagementNodeUri(URI uri) {
             return uri;
         }
         
    +    @Override
    +    public CatalogInitialization getCatalogInitialization() {
    +        if (catalogInitialization!=null) return catalogInitialization;
    +        synchronized (this) {
    +            if (catalogInitialization!=null) return catalogInitialization;
    +            CatalogInitialization ci = new CatalogInitialization();
    +            setCatalogInitialization(ci);
    +            return ci;
    +        }
    +    }
    +    
    +    @Override
    +    public synchronized void 
setCatalogInitialization(CatalogInitialization catalogInitialization) {
    +        if (catalogInitialization!=null) 
catalogInitialization.injectManagementContext(this);
    --- End diff --
    
    I'd much prefer us to fail if the user passes in null, rather than failing 
on an NPE in some unrelated code/thread later.
    
    I'd do something like:
    
        this.catalogInitialization  = checkNotNull(catalogInitialization, 
"catalogInitialization");
        catalogInitialization.injectManagementContext(this);


---
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