Merge pull request #1550 from ustcweizhou/CLOUDSTACK-9380-listDomains-NPE

CLOUDSTACK-9380: fix NPE in listDomains API for a mistakeThe issue happens if volumeTotal is NULL in database.
This is caused by commit 0407fb334f for CLOUDSTACK-7847.

* pr/1550:
  CLOUDSTACK-9380: fix NPE in listDomains API for a mistake

Signed-off-by: Will Stevens <williamstevens@gmail.com>
This commit is contained in:
Will Stevens 2016-05-25 22:58:45 -04:00
commit 550aabb308
1 changed files with 1 additions and 1 deletions

View File

@ -110,7 +110,7 @@ public class DomainJoinDaoImpl extends GenericDaoBase<DomainJoinVO, Long> implem
long volumeLimit = ApiDBUtils.findCorrectResourceLimitForDomain(domain.getVolumeLimit(), fullView, ResourceType.volume, domain.getId());
String volumeLimitDisplay = (fullView || volumeLimit == -1) ? "Unlimited" : String.valueOf(volumeLimit);
long volumeTotal = (domain.getVolumeTotal() == 0) ? 0 : domain.getVolumeTotal();
long volumeTotal = (domain.getVolumeTotal() == null) ? 0 : domain.getVolumeTotal();
String volumeAvail = (fullView || volumeLimit == -1) ? "Unlimited" : String.valueOf(volumeLimit - volumeTotal);
response.setVolumeLimit(volumeLimitDisplay);
response.setVolumeTotal(volumeTotal);