bug 7882: if destroyVolume is called from listener, there is no UserContext, then cause NPE, add more check here

status 7882: resolved fixed
This commit is contained in:
anthony 2011-01-05 18:29:35 -08:00
parent a5913439ae
commit c2d0420c97
1 changed files with 7 additions and 6 deletions

View File

@ -1562,14 +1562,15 @@ public class StorageManagerImpl implements StorageManager {
public void destroyVolume(VolumeVO volume) {
Transaction txn = Transaction.currentTxn();
txn.start();
Long volumeId = volume.getId();
_volsDao.destroyVolume(volumeId);
_volsDao.destroyVolume(volumeId);
String eventParams = "id=" + volumeId;
Long userId = UserContext.current().getUserId();
if (userId == null) {
userId = 1L;
Long userId = 1L;
if ( UserContext.current() != null ) {
userId = UserContext.current().getUserId();
if (userId == 0) {
userId = 1L;
}
}
EventVO event = new EventVO();
event.setAccountId(volume.getAccountId());