Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DCFF31019A for ; Tue, 9 Jul 2013 15:48:41 +0000 (UTC) Received: (qmail 14807 invoked by uid 500); 9 Jul 2013 15:48:41 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 14784 invoked by uid 500); 9 Jul 2013 15:48:41 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 14777 invoked by uid 99); 9 Jul 2013 15:48:41 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Jul 2013 15:48:41 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3C13E8897D4; Tue, 9 Jul 2013 15:48:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mlsorensen@apache.org To: commits@cloudstack.apache.org Message-Id: <4c1905c681974f31a0e358d22d498d67@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to e731722 Date: Tue, 9 Jul 2013 15:48:41 +0000 (UTC) Updated Branches: refs/heads/master 3e7cebee2 -> e73172226 CLOUDSTACK-3422 - fix null pointer in usage and action events when deleting resources whose account has been removed Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e7317222 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e7317222 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e7317222 Branch: refs/heads/master Commit: e731722263feaff5204f4bba45d3e85c100cbd47 Parents: 3e7cebe Author: Marcus Sorensen Authored: Tue Jul 9 09:37:23 2013 -0600 Committer: Marcus Sorensen Committed: Tue Jul 9 09:48:24 2013 -0600 ---------------------------------------------------------------------- server/src/com/cloud/event/ActionEventUtils.java | 5 +++++ server/src/com/cloud/event/UsageEventUtils.java | 4 ++++ 2 files changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7317222/server/src/com/cloud/event/ActionEventUtils.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/event/ActionEventUtils.java b/server/src/com/cloud/event/ActionEventUtils.java index a2d4906..eb3efed 100755 --- a/server/src/com/cloud/event/ActionEventUtils.java +++ b/server/src/com/cloud/event/ActionEventUtils.java @@ -161,6 +161,11 @@ public class ActionEventUtils { Map eventDescription = new HashMap(); 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); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7317222/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 5401244..2d92fae 100644 --- a/server/src/com/cloud/event/UsageEventUtils.java +++ b/server/src/com/cloud/event/UsageEventUtils.java @@ -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);