Github user alexandrelimassantana commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1503#discussion_r61723859
  
    --- Diff: server/src/com/cloud/api/ApiServer.java ---
    @@ -264,10 +266,11 @@ public void handleAsyncJobPublishEvent(String 
subject, String senderAddress, Obj
             String info = job.getCmdInfo();
             String cmdEventType = "unknown";
             if (info != null) {
    -            String marker = "\"cmdEventType\"";
    -            int begin = info.indexOf(marker);
    -            if (begin >= 0) {
    -                cmdEventType = info.substring(begin + marker.length() + 2, 
info.indexOf(",", begin) - 1);
    +            Type type = new TypeToken<Map<String, Object>>(){}.getType();
    +            Map<String, Object> cmdInfo = 
ApiGsonHelper.getBuilder().create().fromJson(info, type);
    --- End diff --
    
    is this Object necessary as the mapped type? Couldn't it be String 
directly? If you are using the api solely for collecting the cmdEventType, you 
could build the objects as String already and the typecheck on line 272 would 
be unnecessary.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to