Program: 106385
Project: 106385
Buggy source:
private String queueCommand(BaseCmd cmdObj,Map<String,String> params) throws Exception {
  UserContext ctx=UserContext.current();
  Long callerUserId=ctx.getCallerUserId();
  Account caller=ctx.getCaller();
  if (cmdObj instanceof BaseAsyncCmd) {
    Long objectId=null;
    String objectUuid=null;
    if (cmdObj instanceof BaseAsyncCreateCmd) {
      BaseAsyncCreateCmd createCmd=(BaseAsyncCreateCmd)cmdObj;
      _dispatcher.dispatchCreateCmd(createCmd,params);
      objectId=createCmd.getEntityId();
      objectUuid=createCmd.getEntityUuid();
      params.put("String_Node_Str",objectId.toString());
    }
 else {
      ApiDispatcher.processParameters(cmdObj,params);
    }
    BaseAsyncCmd asyncCmd=(BaseAsyncCmd)cmdObj;
    if (callerUserId != null) {
      params.put("String_Node_Str",callerUserId.toString());
    }
    if (caller != null) {
      params.put("String_Node_Str",String.valueOf(caller.getId()));
    }
    long startEventId=ctx.getStartEventId();
    asyncCmd.setStartEventId(startEventId);
    Long eventId=EventUtils.saveScheduledEvent((callerUserId == null) ? User.UID_SYSTEM : callerUserId,asyncCmd.getEntityOwnerId(),asyncCmd.getEventType(),asyncCmd.getEventDescription(),startEventId);
    if (startEventId == 0) {
      startEventId=eventId;
    }
    params.put("String_Node_Str",String.valueOf(startEventId));
    ctx.setAccountId(asyncCmd.getEntityOwnerId());
    Long instanceId=(objectId == null) ? asyncCmd.getInstanceId() : objectId;
    AsyncJobVO job=new AsyncJobVO(callerUserId,caller.getId(),cmdObj.getClass().getName(),ApiGsonHelper.getBuilder().create().toJson(params),instanceId,asyncCmd.getInstanceType());
    long jobId=_asyncMgr.submitAsyncJob(job);
    if (jobId == 0L) {
      String errorMsg="String_Node_Str" + job.getCmd();
      s_logger.warn(errorMsg);
      throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,errorMsg);
    }
    if (objectId != null) {
      String objUuid=(objectUuid == null) ? objectId.toString() : objectUuid;
      return ((BaseAsyncCreateCmd)asyncCmd).getResponse(jobId,objUuid);
    }
    SerializationContext.current().setUuidTranslation(true);
    return ApiResponseSerializer.toSerializedString(asyncCmd.getResponse(jobId),asyncCmd.getResponseType());
  }
 else {
    _dispatcher.dispatch(cmdObj,params);
    if (cmdObj instanceof BaseListCmd && !(cmdObj instanceof ListVMsCmd) && !(cmdObj instanceof ListRoutersCmd)&& !(cmdObj instanceof ListSecurityGroupsCmd)&& !(cmdObj instanceof ListTagsCmd)&& !(cmdObj instanceof ListEventsCmd)&& !(cmdObj instanceof ListVMGroupsCmd)&& !(cmdObj instanceof ListProjectsCmd)&& !(cmdObj instanceof ListProjectAccountsCmd)&& !(cmdObj instanceof ListProjectInvitationsCmd)&& !(cmdObj instanceof ListHostsCmd)&& !(cmdObj instanceof ListVolumesCmd)&& !(cmdObj instanceof ListUsersCmd)&& !(cmdObj instanceof ListAccountsCmd)&& !(cmdObj instanceof ListStoragePoolsCmd)) {
      buildAsyncListResponse((BaseListCmd)cmdObj,caller);
    }
    SerializationContext.current().setUuidTranslation(true);
    return ApiResponseSerializer.toSerializedString((ResponseObject)cmdObj.getResponseObject(),cmdObj.getResponseType());
  }
}

Fixed version (ground truth):
private String queueCommand(BaseCmd cmdObj,Map<String,String> params) throws Exception {
  UserContext ctx=UserContext.current();
  Long callerUserId=ctx.getCallerUserId();
  Account caller=ctx.getCaller();
  if (cmdObj instanceof BaseAsyncCmd) {
    Long objectId=null;
    String objectUuid=null;
    if (cmdObj instanceof BaseAsyncCreateCmd) {
      BaseAsyncCreateCmd createCmd=(BaseAsyncCreateCmd)cmdObj;
      _dispatcher.dispatchCreateCmd(createCmd,params);
      objectId=createCmd.getEntityId();
      objectUuid=createCmd.getEntityUuid();
      params.put("String_Node_Str",objectId.toString());
    }
 else {
      ApiDispatcher.processParameters(cmdObj,params);
    }
    BaseAsyncCmd asyncCmd=(BaseAsyncCmd)cmdObj;
    if (callerUserId != null) {
      params.put("String_Node_Str",callerUserId.toString());
    }
    if (caller != null) {
      params.put("String_Node_Str",String.valueOf(caller.getId()));
    }
    long startEventId=ctx.getStartEventId();
    asyncCmd.setStartEventId(startEventId);
    Long eventId=EventUtils.saveScheduledEvent((callerUserId == null) ? User.UID_SYSTEM : callerUserId,asyncCmd.getEntityOwnerId(),asyncCmd.getEventType(),asyncCmd.getEventDescription(),startEventId);
    if (startEventId == 0) {
      startEventId=eventId;
    }
    params.put("String_Node_Str",String.valueOf(startEventId));
    ctx.setAccountId(asyncCmd.getEntityOwnerId());
    Long instanceId=(objectId == null) ? asyncCmd.getInstanceId() : objectId;
    AsyncJobVO job=new AsyncJobVO(callerUserId,caller.getId(),cmdObj.getClass().getName(),ApiGsonHelper.getBuilder().create().toJson(params),instanceId,asyncCmd.getInstanceType());
    long jobId=_asyncMgr.submitAsyncJob(job);
    if (jobId == 0L) {
      String errorMsg="String_Node_Str" + job.getCmd();
      s_logger.warn(errorMsg);
      throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,errorMsg);
    }
    if (objectId != null) {
      String objUuid=(objectUuid == null) ? objectId.toString() : objectUuid;
      return ((BaseAsyncCreateCmd)asyncCmd).getResponse(jobId,objUuid);
    }
    SerializationContext.current().setUuidTranslation(true);
    return ApiResponseSerializer.toSerializedString(asyncCmd.getResponse(jobId),asyncCmd.getResponseType());
  }
 else {
    _dispatcher.dispatch(cmdObj,params);
    if (cmdObj instanceof BaseListCmd && !(cmdObj instanceof ListVMsCmd) && !(cmdObj instanceof ListRoutersCmd)&& !(cmdObj instanceof ListSecurityGroupsCmd)&& !(cmdObj instanceof ListTagsCmd)&& !(cmdObj instanceof ListEventsCmd)&& !(cmdObj instanceof ListVMGroupsCmd)&& !(cmdObj instanceof ListProjectsCmd)&& !(cmdObj instanceof ListProjectAccountsCmd)&& !(cmdObj instanceof ListProjectInvitationsCmd)&& !(cmdObj instanceof ListHostsCmd)&& !(cmdObj instanceof ListVolumesCmd)&& !(cmdObj instanceof ListUsersCmd)&& !(cmdObj instanceof ListAccountsCmd)&& !(cmdObj instanceof ListStoragePoolsCmd)&& !(cmdObj instanceof ListDiskOfferingsCmd)) {
      buildAsyncListResponse((BaseListCmd)cmdObj,caller);
    }
    SerializationContext.current().setUuidTranslation(true);
    return ApiResponseSerializer.toSerializedString((ResponseObject)cmdObj.getResponseObject(),cmdObj.getResponseType());
  }
}