From 85f78d8cb302dc371955f07097c8a5e217da5c05 Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 2 Nov 2010 11:18:18 -0700 Subject: [PATCH] bug 6886: fixing the npe which occurs when we try to delete a non existant user. We were trying to return user details for an async job desc assuming the user always existed. Changing that logic to ensure when we don't have such details, we log the apt message status 6886: resolved fixed --- server/src/com/cloud/api/commands/DeleteUserCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/api/commands/DeleteUserCmd.java b/server/src/com/cloud/api/commands/DeleteUserCmd.java index a2470157183..0b05c59ce08 100644 --- a/server/src/com/cloud/api/commands/DeleteUserCmd.java +++ b/server/src/com/cloud/api/commands/DeleteUserCmd.java @@ -85,7 +85,7 @@ public class DeleteUserCmd extends BaseAsyncCmd { @Override public String getEventDescription() { User user = ApiDBUtils.findUserById(getId()); - return "User " + user.getUsername() + " (id: " + user.getId() + ") and accountId = " + user.getAccountId(); + return (user != null ? ("User " + user.getUsername() + " (id: " + user.getId() + ") and accountId = " + user.getAccountId()) : "user delete, but this user does not exist in the system"); } @Override @SuppressWarnings("unchecked")