Program: 113985
Project: 113985
Buggy source:
@Override public Bundle perform(Bundle extras) throws Exception {
  QBChatDialog dialog=(QBChatDialog)extras.getSerializable(QBServiceConsts.EXTRA_DIALOG);
  long lastDateLoad=extras.getLong(QBServiceConsts.EXTRA_DATE_LAST_UPDATE_HISTORY);
  boolean isLoadOldMessages=extras.getBoolean(QBServiceConsts.EXTRA_LOAD_MORE);
  Bundle returnedBundle=new Bundle();
  QBRequestGetBuilder customObjectRequestBuilder=new QBRequestGetBuilder();
  customObjectRequestBuilder.setLimit(ConstsCore.DIALOG_MESSAGES_PER_PAGE);
  if (isLoadOldMessages) {
    customObjectRequestBuilder.lt(Consts.MESSAGE_DATE_SENT,lastDateLoad);
    customObjectRequestBuilder.sortDesc(QBServiceConsts.EXTRA_DATE_SENT);
  }
 else {
    customObjectRequestBuilder.gt(Consts.MESSAGE_DATE_SENT,lastDateLoad);
    if (lastDateLoad > 0) {
      customObjectRequestBuilder.sortAsc(QBServiceConsts.EXTRA_DATE_SENT);
    }
 else {
      customObjectRequestBuilder.sortDesc(QBServiceConsts.EXTRA_DATE_SENT);
    }
  }
  List<QBChatMessage> dialogMessagesList=baseChatHelper.getDialogMessages(customObjectRequestBuilder,returnedBundle,dialog,lastDateLoad);
  Bundle bundleResult=new Bundle();
  bundleResult.putBoolean(QBServiceConsts.EXTRA_IS_LOAD_NEW_MESSAGES,isLoadOldMessages);
  bundleResult.putLong(QBServiceConsts.EXTRA_LAST_DATE_LOAD_MESSAGES,lastDateLoad);
  bundleResult.putSerializable(QBServiceConsts.EXTRA_DIALOG_MESSAGES,(java.io.Serializable)dialogMessagesList);
  bundleResult.putInt(QBServiceConsts.EXTRA_TOTAL_ENTRIES,dialogMessagesList != null ? dialogMessagesList.size() : ConstsCore.ZERO_INT_VALUE);
  return bundleResult;
}

Fixed version (ground truth):
@Override public Bundle perform(Bundle extras) throws Exception {
  QBChatDialog dialog=(QBChatDialog)extras.getSerializable(QBServiceConsts.EXTRA_DIALOG);
  long lastDateLoad=extras.getLong(QBServiceConsts.EXTRA_DATE_LAST_UPDATE_HISTORY);
  boolean isLoadOldMessages=extras.getBoolean(QBServiceConsts.EXTRA_LOAD_MORE);
  Bundle returnedBundle=new Bundle();
  QBRequestGetBuilder customObjectRequestBuilder=new QBRequestGetBuilder();
  customObjectRequestBuilder.setLimit(ConstsCore.DIALOG_MESSAGES_PER_PAGE);
  if (isLoadOldMessages) {
    customObjectRequestBuilder.lt(Consts.MESSAGE_DATE_SENT,lastDateLoad);
    customObjectRequestBuilder.sortDesc(QBServiceConsts.EXTRA_DATE_SENT);
  }
 else {
    customObjectRequestBuilder.gt(Consts.MESSAGE_DATE_SENT,lastDateLoad);
    if (lastDateLoad > 0) {
      customObjectRequestBuilder.sortAsc(QBServiceConsts.EXTRA_DATE_SENT);
    }
 else {
      customObjectRequestBuilder.sortDesc(QBServiceConsts.EXTRA_DATE_SENT);
    }
  }
  List<QBChatMessage> dialogMessagesList=baseChatHelper.getDialogMessages(customObjectRequestBuilder,returnedBundle,dialog,lastDateLoad);
  Bundle bundleResult=new Bundle();
  bundleResult.putBoolean(QBServiceConsts.EXTRA_IS_LOAD_OLD_MESSAGES,isLoadOldMessages);
  bundleResult.putLong(QBServiceConsts.EXTRA_LAST_DATE_LOAD_MESSAGES,lastDateLoad);
  bundleResult.putSerializable(QBServiceConsts.EXTRA_DIALOG_MESSAGES,(java.io.Serializable)dialogMessagesList);
  bundleResult.putInt(QBServiceConsts.EXTRA_TOTAL_ENTRIES,dialogMessagesList != null ? dialogMessagesList.size() : ConstsCore.ZERO_INT_VALUE);
  return bundleResult;
}