Repository: cloudstack Updated Branches: refs/heads/4.5 176e0d47b -> e7fa3a295
CLOUDSTACK-7563: Fix potential NPE from FingBugs. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e7fa3a29 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e7fa3a29 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e7fa3a29 Branch: refs/heads/4.5 Commit: e7fa3a29594eb748b201865dac3a85f8da024075 Parents: 176e0d4 Author: Min Chen <[email protected]> Authored: Tue Oct 14 10:35:29 2014 -0700 Committer: Min Chen <[email protected]> Committed: Tue Oct 14 11:21:01 2014 -0700 ---------------------------------------------------------------------- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7fa3a29/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index fdf5665..0eafe13 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -1871,7 +1871,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac try { pfma = _agentMgr.send(dstHostId, pfmc); if (pfma == null || !pfma.getResult()) { - String msg = "Unable to prepare for migration due to " + pfma.getDetails(); + String details = (pfma != null) ? pfma.getDetails() : "null answer returned"; + String msg = "Unable to prepare for migration due to " + details; pfma = null; throw new AgentUnavailableException(msg, dstHostId); } @@ -1907,7 +1908,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac try { Answer ma = _agentMgr.send(vm.getLastHostId(), mc); if (ma == null || !ma.getResult()) { - throw new CloudRuntimeException("Unable to migrate due to " + ma.getDetails()); + String details = (ma != null) ? ma.getDetails() : "null answer returned"; + throw new CloudRuntimeException("Unable to migrate due to " + details); } } catch (OperationTimedoutException e) { if (e.isActive()) { @@ -3261,7 +3263,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac try { pfma = _agentMgr.send(dstHostId, pfmc); if (pfma == null || !pfma.getResult()) { - String msg = "Unable to prepare for migration due to " + pfma.getDetails(); + String details = (pfma != null) ? pfma.getDetails() : "null answer returned"; + String msg = "Unable to prepare for migration due to " + details; pfma = null; throw new AgentUnavailableException(msg, dstHostId); } @@ -3294,8 +3297,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac try { Answer ma = _agentMgr.send(vm.getLastHostId(), mc); if (ma == null || !ma.getResult()) { - s_logger.error("Unable to migrate due to " + ma.getDetails()); - throw new CloudRuntimeException("Unable to migrate due to " + ma.getDetails()); + String details = (ma != null) ? ma.getDetails() : "null answer returned"; + String msg = "Unable to migrate due to " + details; + s_logger.error(msg); + throw new CloudRuntimeException(msg); } } catch (OperationTimedoutException e) { if (e.isActive()) {
