CLOUDSTACK-8067: Fixed NPEs in MS log related to console proxy VM (cherry picked from commit 1115bc9cc6ebf2b321bb5a3ff6958d649150cfe5) Signed-off-by: Rohit Yadav <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b07c9b7a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b07c9b7a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b07c9b7a Branch: refs/heads/master Commit: b07c9b7a9c0c4bfff63c722a7d619a96280102f1 Parents: e791e8e Author: Anshul Gangwar <[email protected]> Authored: Thu Dec 11 11:12:18 2014 +0530 Committer: Rohit Yadav <[email protected]> Committed: Fri Dec 12 21:41:38 2014 +0530 ---------------------------------------------------------------------- server/src/com/cloud/consoleproxy/AgentHookBase.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b07c9b7a/server/src/com/cloud/consoleproxy/AgentHookBase.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/consoleproxy/AgentHookBase.java b/server/src/com/cloud/consoleproxy/AgentHookBase.java index 9864cae..8a5bae5 100644 --- a/server/src/com/cloud/consoleproxy/AgentHookBase.java +++ b/server/src/com/cloud/consoleproxy/AgentHookBase.java @@ -208,12 +208,13 @@ public abstract class AgentHookBase implements AgentHook { HostVO consoleProxyHost = findConsoleProxyHost(startupCmd); assert (consoleProxyHost != null); - - Answer answer = _agentMgr.send(consoleProxyHost.getId(), cmd); - if (answer == null || !answer.getResult()) { - s_logger.error("Console proxy agent reported that it failed to execute http handling startup command"); - } else { - s_logger.info("Successfully sent out command to start HTTP handling in console proxy agent"); + if (consoleProxyHost != null) { + Answer answer = _agentMgr.send(consoleProxyHost.getId(), cmd); + if (answer == null || !answer.getResult()) { + s_logger.error("Console proxy agent reported that it failed to execute http handling startup command"); + } else { + s_logger.info("Successfully sent out command to start HTTP handling in console proxy agent"); + } } }catch (NoSuchAlgorithmException e) { s_logger.error("Unexpected exception in SecureRandom Algorithm selection ", e);
