You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mu...@apache.org on 2013/12/05 10:40:46 UTC

git commit: updated refs/heads/master to 22422b9

Updated Branches:
  refs/heads/master 2d369dbdd -> 22422b9dd


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/22422b9d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/22422b9d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/22422b9d

Branch: refs/heads/master
Commit: 22422b9ddd3ea1566f66d971307235569bffb003
Parents: 2d369db
Author: David Grizzanti <dg...@gmail.com>
Authored: Tue Dec 3 11:45:27 2013 -0500
Committer: Murali Reddy <mu...@gmail.com>
Committed: Thu Dec 5 15:10:18 2013 +0530

----------------------------------------------------------------------
 .../components-api/src/com/cloud/event/UsageEventUtils.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/22422b9d/engine/components-api/src/com/cloud/event/UsageEventUtils.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/com/cloud/event/UsageEventUtils.java b/engine/components-api/src/com/cloud/event/UsageEventUtils.java
index e71afb0..90a2f17 100644
--- a/engine/components-api/src/com/cloud/event/UsageEventUtils.java
+++ b/engine/components-api/src/com/cloud/event/UsageEventUtils.java
@@ -153,11 +153,16 @@ 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(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);