You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2015/12/21 12:41:36 UTC

[2/5] incubator-brooklyn git commit: MachineEntity.exec: better NPE if no driver

MachineEntity.exec: better NPE if no driver

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/590bf741
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/590bf741
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/590bf741

Branch: refs/heads/master
Commit: 590bf741d3c4472542e5713e706ae4bdd2192ddd
Parents: 70ed0e1
Author: Aled Sage <al...@gmail.com>
Authored: Sat Dec 19 19:51:15 2015 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Sat Dec 19 19:51:15 2015 +0000

----------------------------------------------------------------------
 .../org/apache/brooklyn/entity/machine/MachineEntityImpl.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/590bf741/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java b/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java
index 881dd7b..87bbc72 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java
@@ -156,8 +156,12 @@ public class MachineEntityImpl extends EmptySoftwareProcessImpl implements Machi
 
     @Override
     public String execCommandTimeout(String command, Duration timeout) {
+        AbstractSoftwareProcessSshDriver driver = (AbstractSoftwareProcessSshDriver) getDriver();
+        if (driver == null) {
+            throw new NullPointerException("No driver for "+this);
+        }
         ProcessTaskWrapper<String> task = SshEffectorTasks.ssh(command)
-                .environmentVariables(((AbstractSoftwareProcessSshDriver) getDriver()).getShellEnvironment())
+                .environmentVariables(driver.getShellEnvironment())
                 .requiringZeroAndReturningStdout()
                 .machine(getMachine())
                 .summary(command)