mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3422 - fix null pointer in usage and action events when
deleting resources whose account has been removed
This commit is contained in:
parent
2005aae7ac
commit
bbff5e84ce
|
|
@ -161,6 +161,11 @@ public class ActionEventUtils {
|
|||
Map<String, String> eventDescription = new HashMap<String, String>();
|
||||
Account account = _accountDao.findById(accountId);
|
||||
User user = _userDao.findById(userId);
|
||||
// if account has been deleted, this might be called during cleanup of resources and results in null pointer
|
||||
if (account == null)
|
||||
return;
|
||||
if (user == null)
|
||||
return;
|
||||
eventDescription.put("user", user.getUuid());
|
||||
eventDescription.put("account", account.getUuid());
|
||||
eventDescription.put("event", eventType);
|
||||
|
|
|
|||
|
|
@ -124,6 +124,10 @@ public class UsageEventUtils {
|
|||
Account account = _accountDao.findById(accountId);
|
||||
DataCenterVO dc = _dcDao.findById(zoneId);
|
||||
|
||||
// if account has been deleted, this might be called during cleanup of resources and results in null pointer
|
||||
if (account == null)
|
||||
return;
|
||||
|
||||
Event event = new Event(ManagementServer.Name, EventCategory.USAGE_EVENT.getName(), usageEventType,
|
||||
resourceType, resourceUUID);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue