cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/4.4 to c422933
Date Fri, 20 Jun 2014 20:32:08 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 6bd9d1241 -> c42293371


CLOUDSTACK-6970: Protect event interpretion from causing NPE exception

(cherry picked from commit 06d8d3a03f7a4efc41c45d9f67fd5b7586a78454)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c4229337
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c4229337
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c4229337

Branch: refs/heads/4.4
Commit: c4229337194aa4edfcca9381ac3985ff56028ed0
Parents: 6bd9d12
Author: Kelven Yang <kelveny@gmail.com>
Authored: Thu May 29 09:35:03 2014 -0700
Committer: Daan Hoogland <daan@onecht.net>
Committed: Fri Jun 20 22:31:56 2014 +0200

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServer.java | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c4229337/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index 4da2714..800b782 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -255,15 +255,20 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler,
ApiSer
 
         // Get the event type from the cmdInfo json string
         String info = job.getCmdInfo();
-        String cmdEventType;
-        if (info == null) {
-            cmdEventType = "unknown";
-        } else {
+        String cmdEventType = "unknown";
+        if (info != null) {
             String marker = "\"cmdEventType\"";
             int begin = info.indexOf(marker);
-            cmdEventType = info.substring(begin + marker.length() + 2, info.indexOf(",",
begin) - 1);
-        }
+            if (begin >= 0) {
+                cmdEventType = info.substring(begin + marker.length() + 2, info.indexOf(",",
begin) - 1);
 
+                if (s_logger.isDebugEnabled())
+                    s_logger.debug("Retrieved cmdEventType from job info: " + cmdEventType);
+            } else {
+                if (s_logger.isDebugEnabled())
+                    s_logger.debug("Unable to locate cmdEventType marker in job info. publish
as unknown event");
+            }
+        }
         // For some reason, the instanceType / instanceId are not abstract, which means we
may get null values.
         org.apache.cloudstack.framework.events.Event event = new org.apache.cloudstack.framework.events.Event(
                 "management-server",


Mime
View raw message