Program: 114305
Project: 114305
Buggy source:
public static void saveChatMessages(Context context,List<QBChatHistoryMessage> messagesList,String dialogId){
  for (  QBChatHistoryMessage historyMessage : messagesList) {
    String messageId=historyMessage.getId();
    String message=historyMessage.getBody();
    int senderId=historyMessage.getSenderId();
    long time=historyMessage.getDateSent();
    String attachURL;
    int friendsMessageTypeCode;
    attachURL=ChatUtils.getAttachUrlFromMessage(historyMessage.getAttachments());
    MessageCache messageCache=new MessageCache(messageId,dialogId,senderId,message,attachURL,time,historyMessage.isRead(),true,true);
    if (historyMessage.getProperty(ChatNotificationUtils.PROPERTY_NOTIFICATION_TYPE) != null) {
      friendsMessageTypeCode=Integer.parseInt(historyMessage.getProperty(ChatNotificationUtils.PROPERTY_NOTIFICATION_TYPE).toString());
      if (ChatNotificationUtils.isFriendsNotificationMessage(friendsMessageTypeCode)) {
        messageCache.setMessagesNotificationType(MessagesNotificationType.parseByCode(friendsMessageTypeCode));
      }
 else       if (ChatNotificationUtils.PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_UPDATE.equals(friendsMessageTypeCode + ConstsCore.EMPTY_STRING)) {
        messageCache.setMessage(ChatNotificationUtils.getBodyForUpdateChatNotificationMessage(context,historyMessage));
        messageCache.setMessagesNotificationType(ChatNotificationUtils.getUpdateChatNotificationMessageType(historyMessage));
      }
    }
    saveChatMessage(context,messageCache);
  }
  updateDialog(context,dialogId,ConstsCore.ZERO_INT_VALUE);
}

Fixed version (ground truth):
public static void saveChatMessages(Context context,List<QBChatHistoryMessage> messagesList,String dialogId){
  for (  QBChatHistoryMessage historyMessage : messagesList) {
    String messageId=historyMessage.getId();
    String message=historyMessage.getBody();
    int senderId=historyMessage.getSenderId();
    long time=historyMessage.getDateSent();
    String attachURL;
    int friendsMessageTypeCode;
    attachURL=ChatUtils.getAttachUrlFromMessage(historyMessage.getAttachments());
    MessageCache messageCache=new MessageCache(messageId,dialogId,senderId,message,attachURL,time,historyMessage.isRead(),true,true);
    if (historyMessage.getProperty(ChatNotificationUtils.PROPERTY_NOTIFICATION_TYPE) != null) {
      friendsMessageTypeCode=Integer.parseInt(historyMessage.getProperty(ChatNotificationUtils.PROPERTY_NOTIFICATION_TYPE).toString());
      if (ChatNotificationUtils.isFriendsNotificationMessage(friendsMessageTypeCode)) {
        messageCache.setMessagesNotificationType(MessagesNotificationType.parseByCode(friendsMessageTypeCode));
      }
 else       if (ChatNotificationUtils.PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_UPDATE.equals(friendsMessageTypeCode + ConstsCore.EMPTY_STRING) || ChatNotificationUtils.PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_CREATE.equals(friendsMessageTypeCode + ConstsCore.EMPTY_STRING)) {
        messageCache.setMessage(ChatNotificationUtils.getBodyForUpdateChatNotificationMessage(context,historyMessage));
        messageCache.setMessagesNotificationType(ChatNotificationUtils.getUpdateChatNotificationMessageType(historyMessage));
      }
    }
    saveChatMessage(context,messageCache);
  }
  updateDialog(context,dialogId,ConstsCore.ZERO_INT_VALUE);
}