brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request: JcloudsSshMachineLocation: avoid NPE...
Date Tue, 29 Mar 2016 10:47:59 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/88#discussion_r57703900
  
    --- Diff: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocation.java
---
    @@ -162,8 +162,12 @@ public void init() {
         @Override
         public void rebind() {
             super.rebind();
    -        ComputeServiceContext context = jcloudsParent.getComputeService().getContext();
    -        runScriptFactory = context.utils().injector().getInstance(RunScriptOnNode.Factory.class);
    +        
    +        if (jcloudsParent != null) {
    +            // can be null on rebind, if location has been "orphaned" somehow
    +            ComputeServiceContext context = jcloudsParent.getComputeService().getContext();
    +            runScriptFactory = context.utils().injector().getInstance(RunScriptOnNode.Factory.class);
    +        }
    --- End diff --
    
    @neykov Yes, it would - if the location were ever used. I'll add a log message in the
else block.
    
    The current behaviour is that Brooklyn fails to rebind because of the NPE, unless you
configure it to ignore errors. It happened for some persisted state that had an "orphaned"
location in its persisted state.
    
    The ideal would be that locations are entities, and that the location can thus be marked
as "on-fire". But that's much longer term.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message