mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-5022: NullPointerException when invalid zone is passed into UsageEventUtils
This commit is contained in:
parent
2d369dbdd8
commit
22422b9ddd
@ -153,11 +153,16 @@ public class UsageEventUtils {
|
|||||||
if (account == null)
|
if (account == null)
|
||||||
return;
|
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(Name, EventCategory.USAGE_EVENT.getName(), usageEventType, resourceType, resourceUUID);
|
Event event = new Event(Name, EventCategory.USAGE_EVENT.getName(), usageEventType, resourceType, resourceUUID);
|
||||||
|
|
||||||
Map<String, String> eventDescription = new HashMap<String, String>();
|
Map<String, String> eventDescription = new HashMap<String, String>();
|
||||||
eventDescription.put("account", account.getUuid());
|
eventDescription.put("account", account.getUuid());
|
||||||
eventDescription.put("zone", dc.getUuid());
|
eventDescription.put("zone", zoneUuid);
|
||||||
eventDescription.put("event", usageEventType);
|
eventDescription.put("event", usageEventType);
|
||||||
eventDescription.put("resource", resourceType);
|
eventDescription.put("resource", resourceType);
|
||||||
eventDescription.put("id", resourceUUID);
|
eventDescription.put("id", resourceUUID);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user