Skip to content

Commit bf1e2c6

Browse files
committed
deal with NPE
1 parent 861ae9a commit bf1e2c6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,9 +2413,11 @@ private void verifyDestinationStorage(Map<String, Storage.StoragePoolType> sourc
24132413
CheckStorageAvailabilityCommand cmd = new CheckStorageAvailabilityCommand(sourcePools);
24142414
try {
24152415
Answer answer = agentManager.send(destHost.getId(), cmd);
2416-
if (answer == null || !answer.getResult()) {
2417-
throw new CloudRuntimeException("Storage verification failed on host "
2418-
+ destHost.getUuid() +": " + answer.getDetails());
2416+
if (answer == null) {
2417+
throw new CloudRuntimeException(String.format("Storage verification failed on host %s: no answer received", destHost.getUuid()));
2418+
}
2419+
if (!answer.getResult()) {
2420+
throw new CloudRuntimeException(String.format("Storage verification failed on host %s: %s", destHost.getUuid(), answer.getDetails()));
24192421
}
24202422
} catch (AgentUnavailableException | OperationTimedoutException e) {
24212423
e.printStackTrace();

0 commit comments

Comments
 (0)