cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [07/13] git commit: updated refs/heads/4.3 to 15ded4f
Date Mon, 24 Nov 2014 18:26:03 GMT
CLOUDSTACK-6970: Protect event interpretion from causing NPE exception

(cherry picked from commit 06d8d3a03f7a4efc41c45d9f67fd5b7586a78454)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/4.3
Commit: 839ef94ce926c78faa0f2b12a91666fa53d2e399
Parents: b716444
Author: Kelven Yang <kelveny@gmail.com>
Authored: Thu May 29 09:35:03 2014 -0700
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Mon Nov 24 23:47:03 2014 +0530

----------------------------------------------------------------------
 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/839ef94c/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 d78eaff..9041a59 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -239,15 +239,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