mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-5022: NullPointerException when invalid zone is passed into UsageEventUtils
This commit is contained in:
parent
cf1eaad846
commit
03ba659ae7
|
|
@ -139,12 +139,17 @@ public class UsageEventUtils {
|
|||
if (account == null)
|
||||
return;
|
||||
|
||||
// if an invalid zone is passed in, create event without zone UUID
|
||||
String zoneUuid = null;
|
||||
if (dc != null)
|
||||
zoneUuid = dc.getUuid();
|
||||
|
||||
Event event = new Event(ManagementServer.Name, EventCategory.USAGE_EVENT.getName(), usageEventType,
|
||||
resourceType, resourceUUID);
|
||||
|
||||
Map<String, String> eventDescription = new HashMap<String, String>();
|
||||
eventDescription.put("account", account.getUuid());
|
||||
eventDescription.put("zone", dc.getUuid());
|
||||
eventDescription.put("zone", zoneUuid);
|
||||
eventDescription.put("event", usageEventType);
|
||||
eventDescription.put("resource", resourceType);
|
||||
eventDescription.put("id", resourceUUID);
|
||||
|
|
|
|||
Loading…
Reference in New Issue