Program: 171966
Project: 171966
Buggy source:
private void sendCMDToPushService(String dataInString,final AVIMMessage message,final AVIMMessageOption messageOption,final AVIMOperation operation,final AVCallback callback,final OperationCompleteCallback occ){
  final int requestId=AVUtils.getNextIMRequestId();
  Intent i=new Intent(AVOSCloud.applicationContext,PushService.class);
  i.setAction(Conversation.AV_CONVERSATION_INTENT_ACTION);
  if (!AVUtils.isBlankString(dataInString)) {
    i.putExtra(Conversation.INTENT_KEY_DATA,dataInString);
  }
  if (message != null) {
    i.putExtra(Conversation.INTENT_KEY_DATA,message);
    if (null != messageOption) {
      i.putExtra(Conversation.INTENT_KEY_MESSAGE_OPTION,messageOption);
      if (!isTransient && null != messageOption.getPriority() && AVOSCloud.isDebugLogEnabled()) {
        LogUtil.avlog.d("String_Node_Str");
      }
    }
  }
  i.putExtra(Conversation.INTENT_KEY_CLIENT,client.clientId);
  i.putExtra(Conversation.INTENT_KEY_CONVERSATION,this.conversationId);
  i.putExtra(Conversation.INTENT_KEY_OPERATION,operation.getCode());
  i.putExtra(Conversation.INTENT_KEY_REQUESTID,requestId);
  AVOSCloud.applicationContext.startService(IntentUtil.setupIntentFlags(i));
  if (callback != null) {
    LocalBroadcastManager.getInstance(AVOSCloud.applicationContext).registerReceiver(new AVIMBaseBroadcastReceiver(callback){
      @Override public void execute(      Intent intent,      Throwable error){
        if (operation.getCode() == AVIMOperation.CONVERSATION_QUIT.getCode()) {
          client.removeConversationCache(AVIMConversation.this);
        }
        if (error == null && occ != null) {
          occ.onComplete();
        }
 else         if (error != null && occ != null) {
          occ.onFailure();
        }
        if (message != null) {
          if (error == null) {
            long timestamp=intent.getExtras().getLong(Conversation.callbackMessageTimeStamp,-1);
            String messageId=intent.getStringExtra(Conversation.callbackMessageId);
            message.setMessageId(messageId);
            message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusSent);
            if (timestamp != -1) {
              message.setTimestamp(timestamp);
            }
            if (null == messageOption || !messageOption.isTransient() && AVIMClient.messageQueryCacheEnabled) {
              setLastMessage(message);
              storage.insertLocalMessage(message);
            }
            AVIMConversation.this.lastMessageAt=new Date(timestamp);
            storage.updateConversationLastMessageAt(AVIMConversation.this);
          }
 else {
            message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed);
          }
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_MESSAGE_QUERY.getCode()) {
          List<AVIMMessage> historyMessages=intent.getParcelableArrayListExtra(Conversation.callbackHistoryMessages);
          setLastReadAt(intent.getLongExtra(Conversation.callbackReadAt,0L),false);
          setLastDeliveredAt(intent.getLongExtra(Conversation.callbackDeliveredAt,0L),false);
          storage.updateConversationTimes(AVIMConversation.this);
          if (error != null) {
            callback.internalDone(null,AVIMException.wrapperAVException(error));
          }
 else {
            if (historyMessages == null) {
              historyMessages=Collections.EMPTY_LIST;
            }
            callback.internalDone(historyMessages,null);
          }
          return;
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_UPDATE.getCode()) {
          if (intent.getExtras().containsKey(Conversation.callbackUpdatedAt)) {
            String updatedAt=intent.getExtras().getString(Conversation.callbackUpdatedAt);
            AVIMConversation.this.updatedAt=updatedAt;
          }
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_MEMBER_COUNT_QUERY.getCode()) {
          int memberCount=intent.getIntExtra(Conversation.callbackMemberCount,0);
          callback.internalDone(memberCount,AVIMException.wrapperAVException(error));
          return;
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_FETCH_RECEIPT_TIME.getCode()) {
          setLastReadAt(intent.getLongExtra(Conversation.callbackReadAt,0L),false);
          setLastDeliveredAt(intent.getLongExtra(Conversation.callbackDeliveredAt,0L),false);
          storage.updateConversationTimes(AVIMConversation.this);
          callback.internalDone(null,AVIMException.wrapperAVException(error));
          return;
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_QUERY.getCode()) {
          if (null != error) {
            callback.internalDone(null,AVIMException.wrapperAVException(error));
          }
 else {
            Exception exception=processQueryResult(intent.getExtras().getSerializable(Conversation.callbackData));
            callback.internalDone(null,AVIMException.wrapperAVException(exception));
          }
          return;
        }
        callback.internalDone(null,AVIMException.wrapperAVException(error));
      }
    }
,new IntentFilter(operation.getOperation() + requestId));
  }
}

Fixed version (ground truth):
private void sendCMDToPushService(String dataInString,final AVIMMessage message,final AVIMMessageOption messageOption,final AVIMOperation operation,final AVCallback callback,final OperationCompleteCallback occ){
  final int requestId=AVUtils.getNextIMRequestId();
  Intent i=new Intent(AVOSCloud.applicationContext,PushService.class);
  i.setAction(Conversation.AV_CONVERSATION_INTENT_ACTION);
  if (!AVUtils.isBlankString(dataInString)) {
    i.putExtra(Conversation.INTENT_KEY_DATA,dataInString);
  }
  if (message != null) {
    i.putExtra(Conversation.INTENT_KEY_DATA,message);
    if (null != messageOption) {
      i.putExtra(Conversation.INTENT_KEY_MESSAGE_OPTION,messageOption);
      if (!isTransient && null != messageOption.getPriority() && AVOSCloud.isDebugLogEnabled()) {
        LogUtil.avlog.d("String_Node_Str");
      }
    }
  }
  i.putExtra(Conversation.INTENT_KEY_CLIENT,client.clientId);
  i.putExtra(Conversation.INTENT_KEY_CONVERSATION,this.conversationId);
  i.putExtra(Conversation.INTENT_KEY_OPERATION,operation.getCode());
  i.putExtra(Conversation.INTENT_KEY_REQUESTID,requestId);
  AVOSCloud.applicationContext.startService(IntentUtil.setupIntentFlags(i));
  if (callback != null) {
    LocalBroadcastManager.getInstance(AVOSCloud.applicationContext).registerReceiver(new AVIMBaseBroadcastReceiver(callback){
      @Override public void execute(      Intent intent,      Throwable error){
        if (operation.getCode() == AVIMOperation.CONVERSATION_QUIT.getCode()) {
          client.removeConversationCache(AVIMConversation.this);
        }
        if (error == null && occ != null) {
          occ.onComplete();
        }
 else         if (error != null && occ != null) {
          occ.onFailure();
        }
        if (message != null) {
          if (error == null) {
            long timestamp=intent.getExtras().getLong(Conversation.callbackMessageTimeStamp,-1);
            String messageId=intent.getStringExtra(Conversation.callbackMessageId);
            message.setMessageId(messageId);
            message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusSent);
            if (timestamp != -1) {
              message.setTimestamp(timestamp);
            }
            if (null == messageOption || !messageOption.isTransient() && AVIMClient.messageQueryCacheEnabled) {
              setLastMessage(message);
              storage.insertLocalMessage(message);
            }
            AVIMConversation.this.lastMessageAt=new Date(timestamp);
            storage.updateConversationLastMessageAt(AVIMConversation.this);
          }
 else {
            message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed);
          }
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_MESSAGE_QUERY.getCode()) {
          List<AVIMMessage> historyMessages=intent.getParcelableArrayListExtra(Conversation.callbackHistoryMessages);
          if (error != null) {
            callback.internalDone(null,new AVIMException(AVIMException.TIMEOUT,AVException.CONNECTION_FAILED,error.getMessage()));
          }
 else {
            setLastReadAt(intent.getLongExtra(Conversation.callbackReadAt,0L),false);
            setLastDeliveredAt(intent.getLongExtra(Conversation.callbackDeliveredAt,0L),false);
            storage.updateConversationTimes(AVIMConversation.this);
            if (historyMessages == null) {
              historyMessages=Collections.EMPTY_LIST;
            }
            callback.internalDone(historyMessages,null);
          }
          return;
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_UPDATE.getCode()) {
          if (intent.getExtras().containsKey(Conversation.callbackUpdatedAt)) {
            String updatedAt=intent.getExtras().getString(Conversation.callbackUpdatedAt);
            AVIMConversation.this.updatedAt=updatedAt;
          }
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_MEMBER_COUNT_QUERY.getCode()) {
          int memberCount=intent.getIntExtra(Conversation.callbackMemberCount,0);
          callback.internalDone(memberCount,AVIMException.wrapperAVException(error));
          return;
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_FETCH_RECEIPT_TIME.getCode()) {
          setLastReadAt(intent.getLongExtra(Conversation.callbackReadAt,0L),false);
          setLastDeliveredAt(intent.getLongExtra(Conversation.callbackDeliveredAt,0L),false);
          storage.updateConversationTimes(AVIMConversation.this);
          callback.internalDone(null,AVIMException.wrapperAVException(error));
          return;
        }
        if (operation.getCode() == AVIMOperation.CONVERSATION_QUERY.getCode()) {
          if (null != error) {
            callback.internalDone(null,AVIMException.wrapperAVException(error));
          }
 else {
            Exception exception=processQueryResult(intent.getExtras().getSerializable(Conversation.callbackData));
            callback.internalDone(null,AVIMException.wrapperAVException(exception));
          }
          return;
        }
        callback.internalDone(null,AVIMException.wrapperAVException(error));
      }
    }
,new IntentFilter(operation.getOperation() + requestId));
  }
}