Updated Branches: refs/heads/4.2 cf1eaad84 -> 03ba659ae
CLOUDSTACK-5022: NullPointerException when invalid zone is passed into UsageEventUtils Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/03ba659a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/03ba659a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/03ba659a Branch: refs/heads/4.2 Commit: 03ba659ae7263ca4fdb7c1c0eaccbecdf45594e8 Parents: cf1eaad Author: David Grizzanti <[email protected]> Authored: Wed Nov 20 14:35:30 2013 -0500 Committer: Murali Reddy <[email protected]> Committed: Tue Dec 3 17:14:28 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/event/UsageEventUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/03ba659a/server/src/com/cloud/event/UsageEventUtils.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/event/UsageEventUtils.java b/server/src/com/cloud/event/UsageEventUtils.java index 2e42229..6cb0f63 100644 --- a/server/src/com/cloud/event/UsageEventUtils.java +++ b/server/src/com/cloud/event/UsageEventUtils.java @@ -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);
