Repository: cloudstack
Updated Branches:
  refs/heads/master 771d05238 -> 4b8bfe262


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/4b8bfe26
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4b8bfe26
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4b8bfe26

Branch: refs/heads/master
Commit: 4b8bfe26275f7eb6e98abe77849153eaa93e8205
Parents: 771d052
Author: Min Chen <[email protected]>
Authored: Tue Oct 14 10:35:29 2014 -0700
Committer: Min Chen <[email protected]>
Committed: Tue Oct 14 11:19:39 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/4b8bfe26/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 d458950..de2fd28 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -1873,7 +1873,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);
             }
@@ -1909,7 +1910,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()) {
@@ -3263,7 +3265,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);
             }
@@ -3296,8 +3299,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()) {

Reply via email to