nus-yam/ex-repair huggingface dataset:
Program: 114280
Project: 114280
Buggy source:
@Override public void execute(Bundle bundle){
  Exception exception=(Exception)bundle.getSerializable(QBServiceConsts.EXTRA_ERROR);
  String errorMessage=exception.getMessage();
  if (exception.getMessage().equals(resources.getString(R.string.error_bad_timestamp))) {
    errorMessage=resources.getString(R.string.error_bad_timestamp_from_app);
  }
  DialogUtils.showLong(LandingActivity.this,errorMessage);
  hideProgress();
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  Exception exception=(Exception)bundle.getSerializable(QBServiceConsts.EXTRA_ERROR);
  String errorMessage=exception.getMessage();
  if (exception.getMessage().equals(resources.getString(R.string.error_bad_timestamp))) {
    errorMessage=resources.getString(R.string.error_bad_timestamp_from_app);
  }
 else   if (exception.getMessage().equals(resources.getString(R.string.error_email_already_taken)) && startedLoginType.equals(LoginType.FACEBOOK)) {
    errorMessage=resources.getString(R.string.error_email_already_taken_from_app);
  }
  DialogUtils.showLong(LandingActivity.this,errorMessage);
  hideProgress();
}
Program: 114281
Project: 114281
Buggy source:
@Override public void execute(Bundle bundle){
  Exception exception=(Exception)bundle.getSerializable(QBServiceConsts.EXTRA_ERROR);
  int errorCode=bundle.getInt(QBServiceConsts.EXTRA_ERROR_CODE);
  String errorMessage=exception.getMessage();
  if (exception.getMessage().equals(resources.getString(R.string.error_bad_timestamp))) {
    errorMessage=resources.getString(R.string.error_bad_timestamp_from_app);
  }
  validationUtils.setError(errorMessage);
  hideProgress();
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  Exception exception=(Exception)bundle.getSerializable(QBServiceConsts.EXTRA_ERROR);
  int errorCode=bundle.getInt(QBServiceConsts.EXTRA_ERROR_CODE);
  String errorMessage;
  if (exception.getMessage().equals(resources.getString(R.string.error_bad_timestamp))) {
    errorMessage=resources.getString(R.string.error_bad_timestamp_from_app);
    validationUtils.setError(errorMessage);
  }
 else   if (exception.getMessage().equals(resources.getString(R.string.error_email_already_taken)) && startedLoginType.equals(LoginType.FACEBOOK)) {
    errorMessage=resources.getString(R.string.error_email_already_taken_from_app);
    DialogUtils.showLong(LoginActivity.this,errorMessage);
  }
  hideProgress();
}
Program: 114282
Project: 114282
Buggy source:
private void handleAddedFriends(Intent data){
  addedFriendIdsList=(ArrayList<Integer>)data.getSerializableExtra(QBServiceConsts.EXTRA_FRIENDS);
  if (addedFriendIdsList != null) {
    currentNotificationTypeList.add(MessagesNotificationType.ADDED_DIALOG);
    sendNotificationToGroup();
  }
}

Fixed version (ground truth):
private void handleAddedFriends(Intent data){
  addedFriendIdsList=(ArrayList<Integer>)data.getSerializableExtra(QBServiceConsts.EXTRA_FRIENDS);
  if (addedFriendIdsList != null) {
    try {
      multiChatHelper.sendNotificationToPrivateChatAboutCreatingGroupChat(currentDialog,addedFriendIdsList);
    }
 catch (    Exception e) {
      ErrorUtils.logError(e);
    }
    currentNotificationTypeList.add(MessagesNotificationType.ADDED_DIALOG);
    sendNotificationToGroup();
  }
}
Program: 114283
Project: 114283
Buggy source:
private void doAutoLogin(String userEmail,String userPassword){
  if (LoginType.EMAIL.equals(getCurrentLoginType())) {
    login(userEmail,userPassword);
  }
 else {
    facebookHelper.loginWithFacebook();
  }
}

Fixed version (ground truth):
private void doAutoLogin(String userEmail,String userPassword){
  if (LoginType.EMAIL.equals(getCurrentLoginType())) {
    login(userEmail,userPassword);
  }
 else {
    FacebookHelper.logout();
    facebookHelper.loginWithFacebook();
  }
}
Program: 114284
Project: 114284
Buggy source:
@Override public void run(){
  stopTypingMessage();
}

Fixed version (ground truth):
@Override public void run(){
  isTypingNow=false;
  sendTypingStatus();
}
Program: 114285
Project: 114285
Buggy source:
@Override protected void onPause(){
  super.onPause();
  onUpdateChatDialog();
  hideSmileLayout();
  if (QBDialogType.PRIVATE.equals(dialog.getType())) {
    if (isTypingNow) {
      stopTypingMessage();
    }
  }
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  onUpdateChatDialog();
  hideSmileLayout();
  if (QBDialogType.PRIVATE.equals(dialog.getType())) {
    if (isTypingNow) {
      isTypingNow=false;
      sendTypingStatus();
    }
  }
}
Program: 114286
Project: 114286
Buggy source:
@Override public void onTextChanged(CharSequence charSequence,int start,int before,int count){
  super.onTextChanged(charSequence,start,before,count);
  setSendButtonVisibility(charSequence);
  if (QBDialogType.PRIVATE.equals(dialog.getType())) {
    if (!isTypingNow) {
      startTypingMessage();
    }
    checkStopTyping();
  }
}

Fixed version (ground truth):
@Override public void onTextChanged(CharSequence charSequence,int start,int before,int count){
  super.onTextChanged(charSequence,start,before,count);
  setSendButtonVisibility(charSequence);
  if (QBDialogType.PRIVATE.equals(dialog.getType())) {
    if (!isTypingNow) {
      isTypingNow=true;
      sendTypingStatus();
    }
    checkStopTyping();
  }
}
Program: 114288
Project: 114288
Buggy source:
@Override public boolean onTouch(View view,MotionEvent event){
  hideSmileLayout();
  if (QBDialogType.PRIVATE.equals(dialog.getType())) {
    if (!isTypingNow) {
      startTypingMessage();
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onTouch(View view,MotionEvent event){
  hideSmileLayout();
  if (QBDialogType.PRIVATE.equals(dialog.getType())) {
    if (!isTypingNow) {
      isTypingNow=true;
      sendTypingStatus();
    }
  }
  return false;
}
Program: 114289
Project: 114289
Buggy source:
public QBBaseChatHelper(Context context){
  super(context);
  privateChatMessageListener=new PrivateChatMessageListener();
  privateChatManagerListener=new PrivateChatManagerListener();
  privateChatIsTypingListener=new PrivateChatIsTypingListener();
  groupChatMessageListener=new GroupChatMessageListener();
  notificationChatListeners=new CopyOnWriteArrayList<QBNotificationChatListener>();
}

Fixed version (ground truth):
public QBBaseChatHelper(Context context){
  super(context);
  privateChatMessageListener=new PrivateChatMessageListener();
  groupChatMessageListener=new GroupChatMessageListener();
  notificationChatListeners=new CopyOnWriteArrayList<QBNotificationChatListener>();
}
Program: 114290
Project: 114290
Buggy source:
protected void onPrivateMessageReceived(QBPrivateChat privateChat,QBChatMessage chatMessage){
}

Fixed version (ground truth):
public void onPrivateMessageReceived(QBChat privateChat,final QBChatMessage chatMessage){
}
Program: 114291
Project: 114291
Buggy source:
public void init(QBUser chatCreator){
  this.chatService=QBChatService.getInstance();
  this.chatCreator=chatCreator;
  privateChatManager=chatService.getPrivateChatManager();
  privateChatManager.addPrivateChatManagerListener(privateChatManagerListener);
  groupChatManager=chatService.getGroupChatManager();
}

Fixed version (ground truth):
public void init(QBUser chatCreator){
  this.chatService=QBChatService.getInstance();
  this.chatCreator=chatCreator;
  privateChatManager=chatService.getPrivateChatManager();
  groupChatManager=chatService.getGroupChatManager();
}
Program: 114292
Project: 114292
Buggy source:
protected void onGroupMessageReceived(QBGroupChat groupChat,QBChatMessage chatMessage){
}

Fixed version (ground truth):
public void onGroupMessageReceived(QBChat groupChat,final QBChatMessage chatMessage){
}
Program: 114293
Project: 114293
Buggy source:
@Override protected void onGroupMessageReceived(QBGroupChat groupChat,QBChatMessage chatMessage){
  User user=UsersDatabaseManager.getUserById(context,chatMessage.getSenderId());
  MessageCache messageCache;
  if (user == null) {
    user=ChatUtils.getTempUserFromChatMessage(chatMessage);
  }
  messageCache=parseReceivedMessage(chatMessage);
  if (ChatNotificationUtils.isNotificationMessage(chatMessage)) {
    messageCache.setMessagesNotificationType(ChatNotificationUtils.getUpdateChatNotificationMessageType(chatMessage));
    messageCache.setMessage(ChatNotificationUtils.getBodyForUpdateChatNotificationMessage(context,chatMessage));
  }
  saveMessageToCache(messageCache);
  if (!chatMessage.getSenderId().equals(chatCreator.getId())) {
    notifyMessageReceived(chatMessage,user,messageCache.getDialogId(),false);
  }
}

Fixed version (ground truth):
public void onGroupMessageReceived(QBChat chat,QBChatMessage chatMessage){
  User user=UsersDatabaseManager.getUserById(context,chatMessage.getSenderId());
  MessageCache messageCache;
  if (user == null) {
    user=ChatUtils.getTempUserFromChatMessage(chatMessage);
  }
  messageCache=parseReceivedMessage(chatMessage);
  if (ChatNotificationUtils.isNotificationMessage(chatMessage)) {
    messageCache.setMessagesNotificationType(ChatNotificationUtils.getUpdateChatNotificationMessageType(chatMessage));
    messageCache.setMessage(ChatNotificationUtils.getBodyForUpdateChatNotificationMessage(context,chatMessage));
  }
  saveMessageToCache(messageCache);
  if (!chatMessage.getSenderId().equals(chatCreator.getId())) {
    notifyMessageReceived(chatMessage,user,messageCache.getDialogId(),false);
  }
}
Program: 114294
Project: 114294
Buggy source:
private QBDialog getQBDialog(){
  Cursor cursor=(Cursor)messagesAdapter.getItem(messagesAdapter.getCount() - 1);
  MessageCache messageCache=ChatDatabaseManager.getMessageCacheFromCursor(cursor);
  if (messageCache.getMessagesNotificationType() == null) {
    dialog.setLastMessage(messageCache.getMessage());
  }
 else {
    dialog.setLastMessage(getResources().getString(R.string.notification_message));
  }
  dialog.setLastMessageDateSent(messageCache.getTime());
  dialog.setUnreadMessageCount(ConstsCore.ZERO_INT_VALUE);
  return dialog;
}

Fixed version (ground truth):
private QBDialog getQBDialog(){
  Cursor cursor=(Cursor)messagesAdapter.getItem(messagesAdapter.getCount() - 1);
  MessageCache messageCache=ChatDatabaseManager.getMessageCacheFromCursor(cursor);
  MessagesNotificationType messagesNotificationType=messageCache.getMessagesNotificationType();
  if (messagesNotificationType == null) {
    dialog.setLastMessage(messageCache.getMessage());
  }
 else   if (ChatNotificationUtils.isUpdateDialogNotificationMessage(messagesNotificationType.getCode())) {
    dialog.setLastMessage(messageCache.getMessage());
  }
  dialog.setLastMessageDateSent(messageCache.getTime());
  dialog.setUnreadMessageCount(ConstsCore.ZERO_INT_VALUE);
  return dialog;
}
Program: 114295
Project: 114295
Buggy source:
@Override public void execute(Bundle bundle){
  hideProgress();
  QBDialog dialog=(QBDialog)bundle.getSerializable(QBServiceConsts.EXTRA_DIALOG);
  if (dialog.getRoomJid() != null) {
    GroupDialogActivity.start(NewDialogActivity.this,dialog);
    sendNotificationToGroup(dialog);
    finish();
  }
 else {
    ErrorUtils.showError(NewDialogActivity.this,getString(R.string.dlg_fail_create_groupchat));
  }
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  hideProgress();
  QBDialog dialog=(QBDialog)bundle.getSerializable(QBServiceConsts.EXTRA_DIALOG);
  if (dialog.getRoomJid() != null) {
    GroupDialogActivity.start(NewDialogActivity.this,dialog);
    finish();
  }
 else {
    ErrorUtils.showError(NewDialogActivity.this,getString(R.string.dlg_fail_create_groupchat));
  }
}
Program: 114296
Project: 114296
Buggy source:
private QBDialog getDialog(){
  Cursor cursor=(Cursor)messagesAdapter.getItem(messagesAdapter.getCount() - 1);
  MessageCache messageCache=ChatDatabaseManager.getMessageCacheFromCursor(cursor);
  if (messageCache.getMessagesNotificationType() == null) {
    dialog.setLastMessage(messageCache.getMessage());
  }
 else {
    dialog.setLastMessage(getResources().getString(R.string.notification_message));
  }
  dialog.setLastMessageDateSent(messageCache.getTime());
  dialog.setUnreadMessageCount(ConstsCore.ZERO_INT_VALUE);
  dialog.setLastMessageUserId(messageCache.getSenderId());
  dialog.setType(QBDialogType.PRIVATE);
  return dialog;
}

Fixed version (ground truth):
private QBDialog getDialog(){
  Cursor cursor=(Cursor)messagesAdapter.getItem(messagesAdapter.getCount() - 1);
  MessageCache messageCache=ChatDatabaseManager.getMessageCacheFromCursor(cursor);
  MessagesNotificationType messagesNotificationType=messageCache.getMessagesNotificationType();
  if (messagesNotificationType == null) {
    dialog.setLastMessage(messageCache.getMessage());
  }
 else   if (ChatNotificationUtils.isFriendsNotificationMessage(messagesNotificationType.getCode())) {
    dialog.setLastMessage(getResources().getString(R.string.frl_friends_contact_request));
  }
 else   if (ChatNotificationUtils.isUpdateDialogNotificationMessage(messagesNotificationType.getCode())) {
    dialog.setLastMessage(messageCache.getMessage());
  }
  dialog.setLastMessageDateSent(messageCache.getTime());
  dialog.setUnreadMessageCount(ConstsCore.ZERO_INT_VALUE);
  dialog.setLastMessageUserId(messageCache.getSenderId());
  dialog.setType(QBDialogType.PRIVATE);
  return dialog;
}
Program: 114297
Project: 114297
Buggy source:
public static void saveChatMessages(Context context,List<QBChatHistoryMessage> messagesList,String dialogId){
  MessageCache messageCache=null;
  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=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.isFriendsMessageTypeCode(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.getNotificationMessage(context,historyMessage));
        messageCache.setMessagesNotificationType(ChatNotificationUtils.getNotificationMessageType(historyMessage));
      }
    }
    saveChatMessage(context,messageCache,true);
  }
}

Fixed version (ground truth):
public static void saveChatMessages(Context context,List<QBChatHistoryMessage> messagesList,String dialogId){
  MessageCache messageCache=null;
  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=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.getBodyForChatNotificationMessage(context,historyMessage));
        messageCache.setMessagesNotificationType(ChatNotificationUtils.getNotificationMessageType(historyMessage));
      }
    }
    saveChatMessage(context,messageCache);
  }
}
Program: 114298
Project: 114298
Buggy source:
public static void updateDialog(Context context,String dialogId,String lastMessage,long dateSent,long lastSenderId,int countUnreadMessages){
  ContentResolver resolver=context.getContentResolver();
  ContentValues values=new ContentValues();
  if (countUnreadMessages >= ConstsCore.ZERO_INT_VALUE) {
    values.put(DialogTable.Cols.COUNT_UNREAD_MESSAGES,countUnreadMessages);
  }
  if (TextUtils.isEmpty(lastMessage)) {
    values.put(DialogTable.Cols.LAST_MESSAGE,lastMessage);
  }
 else {
    values.put(DialogTable.Cols.LAST_MESSAGE,Html.fromHtml(lastMessage).toString());
  }
  values.put(DialogTable.Cols.LAST_MESSAGE_USER_ID,lastSenderId);
  values.put(DialogTable.Cols.LAST_DATE_SENT,dateSent);
  String condition=DialogTable.Cols.DIALOG_ID + "String_Node_Str" + dialogId+ "String_Node_Str";
  resolver.update(DialogTable.CONTENT_URI,values,condition,null);
}

Fixed version (ground truth):
public static void updateDialog(Context context,String dialogId,String lastMessage,long dateSent,long lastSenderId,int countUnreadMessages){
  ContentResolver resolver=context.getContentResolver();
  ContentValues values=getContentValuesForUpdateDialog(dateSent,lastSenderId,countUnreadMessages);
  if (TextUtils.isEmpty(lastMessage)) {
    values.put(DialogTable.Cols.LAST_MESSAGE,lastMessage);
  }
 else {
    values.put(DialogTable.Cols.LAST_MESSAGE,Html.fromHtml(lastMessage).toString());
  }
  String condition=DialogTable.Cols.DIALOG_ID + "String_Node_Str" + dialogId+ "String_Node_Str";
  resolver.update(DialogTable.CONTENT_URI,values,condition,null);
}
Program: 114299
Project: 114299
Buggy source:
private static String parseMessageBody(Context context,MessageCache messageCache){
  String resultMessage=messageCache.getMessage();
  if (messageCache.getMessagesNotificationType() != null && !ChatNotificationUtils.isNotificationMessageUpdateDialog(messageCache.getMessagesNotificationType().getCode())) {
    resultMessage=ChatNotificationUtils.getResourceBodyForNotificationType(context,messageCache.getMessagesNotificationType(),messageCache);
  }
 else {
    if (!TextUtils.isEmpty(messageCache.getMessage())) {
      resultMessage=Html.fromHtml(messageCache.getMessage()).toString();
    }
  }
  return resultMessage;
}

Fixed version (ground truth):
private static String parseMessageBody(Context context,MessageCache messageCache){
  String resultMessage=messageCache.getMessage();
  if (messageCache.getMessagesNotificationType() != null && !ChatNotificationUtils.isUpdateDialogNotificationMessage(messageCache.getMessagesNotificationType().getCode())) {
    resultMessage=ChatNotificationUtils.getBodyForFriendsNotificationMessage(context,messageCache.getMessagesNotificationType(),messageCache);
  }
 else {
    if (!TextUtils.isEmpty(messageCache.getMessage())) {
      resultMessage=Html.fromHtml(messageCache.getMessage()).toString();
    }
  }
  return resultMessage;
}
Program: 114301
Project: 114301
Buggy source:
private void initLocalBroadcastManagers(){
  typingMessageBroadcastReceiver=new TypingStatusBroadcastReceiver();
  LocalBroadcastManager.getInstance(this).registerReceiver(typingMessageBroadcastReceiver,new IntentFilter(QBServiceConsts.TYPING_MESSAGE));
}

Fixed version (ground truth):
private void initLocalBroadcastManagers(){
  typingMessageBroadcastReceiver=new TypingStatusBroadcastReceiver();
  LocalBroadcastManager.getInstance(this).registerReceiver(typingMessageBroadcastReceiver,new IntentFilter(QBServiceConsts.TYPING_MESSAGE));
  updatingDialogBroadcastReceiver=new UpdatingDialogBroadcastReceiver();
  LocalBroadcastManager.getInstance(this).registerReceiver(updatingDialogBroadcastReceiver,new IntentFilter(QBServiceConsts.UPDATE_DIALOG));
}
Program: 114302
Project: 114302
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  Bundle extras=intent.getExtras();
  if (QBDialogType.PRIVATE.equals(dialog.getType())) {
    boolean isTyping=extras.getBoolean(QBServiceConsts.EXTRA_IS_TYPING);
    if (isTyping) {
      startMessageTypingAnimation();
    }
 else {
      stopMessageTypingAnimation();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  updateDialogData();
}
Program: 114303
Project: 114303
Buggy source:
@Override protected void onResume(){
  super.onResume();
  updateChatData();
  scrollListView();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  updateDialogData();
  scrollListView();
}
Program: 114304
Project: 114304
Buggy source:
private void updateActionBar(){
  actionBar.setTitle(groupName);
  actionBar.setSubtitle(getString(R.string.gdd_participants,dialog.getOccupants().size()));
  actionBar.setLogo(R.drawable.placeholder_group);
  if (!TextUtils.isEmpty(dialog.getPhoto())) {
    loadLogoActionBar(dialog.getPhoto());
  }
}

Fixed version (ground truth):
protected void updateActionBar(){
  actionBar.setTitle(dialog.getName());
  actionBar.setSubtitle(getString(R.string.gdd_participants,dialog.getOccupants().size()));
  actionBar.setLogo(R.drawable.placeholder_group);
  if (!TextUtils.isEmpty(dialog.getPhoto())) {
    loadLogoActionBar(dialog.getPhoto());
  }
}
Program: 114306
Project: 114306
Buggy source:
public QBDialog createGroupChat(String name,List<Integer> friendIdsList) throws Exception {
  ArrayList<Integer> occupantIdsList=ChatUtils.getOccupantIdsWithUser(friendIdsList);
  QBDialog dialogToCreate=new QBDialog();
  dialogToCreate.setName(name);
  dialogToCreate.setType(QBDialogType.GROUP);
  dialogToCreate.setOccupantsIds(occupantIdsList);
  QBDialog dialog=groupChatManager.createDialog(dialogToCreate);
  joinRoomChat(dialog);
  saveDialogToCache(dialog);
  sendNotificationToPrivateChatAboutCreatingGroupChat(dialog,friendIdsList);
  QBChatMessage chatMessage=ChatNotificationUtils.createNotificationMessageForUpdateChat(context,dialog,MessagesNotificationType.CREATE_DIALOG,dialog.getOccupants());
  sendGroupMessage(chatMessage,dialog.getRoomJid(),dialog.getDialogId());
  return dialog;
}

Fixed version (ground truth):
public QBDialog createGroupChat(String name,List<Integer> friendIdsList) throws Exception {
  ArrayList<Integer> occupantIdsList=ChatUtils.getOccupantIdsWithUser(friendIdsList);
  QBDialog dialogToCreate=new QBDialog();
  dialogToCreate.setName(name);
  dialogToCreate.setType(QBDialogType.GROUP);
  dialogToCreate.setOccupantsIds(occupantIdsList);
  QBDialog dialog=groupChatManager.createDialog(dialogToCreate);
  joinRoomChat(dialog);
  saveDialogToCache(dialog);
  sendNotificationToPrivateChatAboutCreatingGroupChat(dialog,friendIdsList);
  QBChatMessage chatMessage=ChatNotificationUtils.createNotificationMessageForCreateGroupChat(context,dialog.getOccupants());
  sendGroupMessage(chatMessage,dialog.getRoomJid(),dialog.getDialogId());
  return dialog;
}
Program: 114307
Project: 114307
Buggy source:
public void onGroupMessageReceived(QBChat chat,QBChatMessage chatMessage){
  User user=UsersDatabaseManager.getUserById(context,chatMessage.getSenderId());
  MessageCache messageCache;
  if (user == null) {
    user=ChatUtils.getTempUserFromChatMessage(chatMessage);
  }
  messageCache=parseReceivedMessage(chatMessage);
  if (ChatNotificationUtils.isNotificationMessage(chatMessage)) {
    messageCache.setMessagesNotificationType(ChatNotificationUtils.getUpdateChatNotificationMessageType(chatMessage));
    messageCache.setMessage(ChatNotificationUtils.getBodyForUpdateChatNotificationMessage(context,chatMessage));
  }
  saveMessageToCache(messageCache);
  if (!chatMessage.getSenderId().equals(chatCreator.getId())) {
    notifyMessageReceived(chatMessage,user,messageCache.getDialogId(),false);
  }
}

Fixed version (ground truth):
public void onGroupMessageReceived(QBChat chat,QBChatMessage chatMessage){
  User user=UsersDatabaseManager.getUserById(context,chatMessage.getSenderId());
  MessageCache messageCache;
  if (user == null) {
    user=ChatUtils.getTempUserFromChatMessage(chatMessage);
  }
  messageCache=parseReceivedMessage(chatMessage);
  if (ChatNotificationUtils.isNotificationMessage(chatMessage)) {
    messageCache.setMessagesNotificationType(ChatNotificationUtils.getUpdateChatNotificationMessageType(chatMessage));
    messageCache.setMessage(ChatNotificationUtils.getBodyForUpdateChatNotificationMessage(context,chatMessage));
    updateDialogByNotification(chatMessage);
  }
  saveMessageToCache(messageCache);
  if (!chatMessage.getSenderId().equals(chatCreator.getId())) {
    notifyMessageReceived(chatMessage,user,messageCache.getDialogId(),false);
  }
}
Program: 114308
Project: 114308
Buggy source:
@Override public void onReceivedNotification(String notificationType,QBChatMessage chatMessage){
  if (ChatNotificationUtils.PROPERTY_TYPE_TO_PRIVATE_CHAT__GROUP_CHAT_CREATE.equals(notificationType)) {
    createDialogByNotification(chatMessage,MessagesNotificationType.CREATE_DIALOG);
  }
 else   if (ChatNotificationUtils.PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_UPDATE.equals(notificationType)) {
    updateDialogByNotification(chatMessage);
  }
}

Fixed version (ground truth):
@Override public void onReceivedNotification(String notificationType,QBChatMessage chatMessage){
  if (ChatNotificationUtils.PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_CREATE.equals(notificationType)) {
    createDialogByNotification(chatMessage,MessagesNotificationType.CREATE_DIALOG);
  }
 else   if (ChatNotificationUtils.PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_UPDATE.equals(notificationType)) {
    updateDialogByNotification(chatMessage);
  }
}
Program: 114309
Project: 114309
Buggy source:
private void updateDialogByNotification(QBChatMessage chatMessage){
  String dialogId=chatMessage.getProperty(ChatNotificationUtils.PROPERTY_DIALOG_ID);
  String lastMessage=ChatNotificationUtils.getBodyForUpdateChatNotificationMessage(context,chatMessage);
  QBDialog dialog=ChatDatabaseManager.getDialogByDialogId(context,dialogId);
  if (dialog == null) {
    dialog=ChatNotificationUtils.parseDialogFromQBMessage(context,chatMessage,lastMessage,QBDialogType.GROUP);
    saveDialogToCache(dialog);
  }
}

Fixed version (ground truth):
private void updateDialogByNotification(QBChatMessage chatMessage){
  String dialogId=chatMessage.getProperty(ChatNotificationUtils.PROPERTY_DIALOG_ID);
  QBDialog dialog=ChatDatabaseManager.getDialogByDialogId(context,dialogId);
  ChatNotificationUtils.updateDialogFromQBMessage(context,chatMessage,dialog);
  saveDialogToCache(dialog);
  notifyUpdatingDialog();
}
Program: 114310
Project: 114310
Buggy source:
public static MessagesNotificationType getUpdateChatNotificationMessageType(QBMessage chatMessage){
  String notificationType=chatMessage.getProperty(PROPERTY_NOTIFICATION_TYPE);
  String occupantsIds=chatMessage.getProperty(PROPERTY_OCCUPANTS_IDS);
  String dialogName=chatMessage.getProperty(PROPERTY_ROOM_NAME);
  String photoUrl=chatMessage.getProperty(PROPERTY_ROOM_PHOTO);
  String leave=chatMessage.getProperty(PROPERTY_ROOM_LEAVE);
  if (!TextUtils.isEmpty(occupantsIds) && notificationType.equals(PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_UPDATE)) {
    return MessagesNotificationType.ADDED_DIALOG;
  }
  if (!TextUtils.isEmpty(occupantsIds) && notificationType.equals(PROPERTY_TYPE_TO_PRIVATE_CHAT__GROUP_CHAT_CREATE)) {
    return MessagesNotificationType.CREATE_DIALOG;
  }
  if (!TextUtils.isEmpty(dialogName)) {
    return MessagesNotificationType.NAME_DIALOG;
  }
  if (!TextUtils.isEmpty(photoUrl)) {
    return MessagesNotificationType.PHOTO_DIALOG;
  }
  if (!TextUtils.isEmpty(leave)) {
    return MessagesNotificationType.LEAVE_DIALOG;
  }
  return null;
}

Fixed version (ground truth):
public static MessagesNotificationType getUpdateChatNotificationMessageType(QBMessage chatMessage){
  String notificationType=chatMessage.getProperty(PROPERTY_NOTIFICATION_TYPE);
  String occupantsIds=chatMessage.getProperty(PROPERTY_OCCUPANTS_IDS);
  String dialogName=chatMessage.getProperty(PROPERTY_ROOM_NAME);
  String photoUrl=chatMessage.getProperty(PROPERTY_ROOM_PHOTO);
  String leave=chatMessage.getProperty(PROPERTY_ROOM_LEAVE);
  if (!TextUtils.isEmpty(occupantsIds) && notificationType.equals(PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_UPDATE)) {
    return MessagesNotificationType.ADDED_DIALOG;
  }
  if (!TextUtils.isEmpty(occupantsIds) && notificationType.equals(PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_CREATE)) {
    return MessagesNotificationType.CREATE_DIALOG;
  }
  if (!TextUtils.isEmpty(dialogName)) {
    return MessagesNotificationType.NAME_DIALOG;
  }
  if (!TextUtils.isEmpty(photoUrl)) {
    return MessagesNotificationType.PHOTO_DIALOG;
  }
  if (!TextUtils.isEmpty(leave)) {
    return MessagesNotificationType.LEAVE_DIALOG;
  }
  return null;
}
Program: 114311
Project: 114311
Buggy source:
public static int getNotificationTypeIfExist(QBChatMessage chatMessage){
  int friendsMessageTypeCode=ConstsCore.ZERO_INT_VALUE;
  if (chatMessage.getProperty(PROPERTY_NOTIFICATION_TYPE) != null) {
    String inputCode=chatMessage.getProperty(PROPERTY_NOTIFICATION_TYPE);
    if (PROPERTY_TYPE_TO_PRIVATE_CHAT__GROUP_CHAT_CREATE.equals(inputCode)) {
      friendsMessageTypeCode=MessagesNotificationType.CREATE_DIALOG.getCode();
    }
 else {
      friendsMessageTypeCode=Integer.parseInt(inputCode);
    }
  }
  return friendsMessageTypeCode;
}

Fixed version (ground truth):
public static int getNotificationTypeIfExist(QBChatMessage chatMessage){
  int friendsMessageTypeCode=ConstsCore.ZERO_INT_VALUE;
  if (chatMessage.getProperty(PROPERTY_NOTIFICATION_TYPE) != null) {
    String inputCode=chatMessage.getProperty(PROPERTY_NOTIFICATION_TYPE);
    if (PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_CREATE.equals(inputCode)) {
      friendsMessageTypeCode=MessagesNotificationType.CREATE_DIALOG.getCode();
    }
 else {
      friendsMessageTypeCode=Integer.parseInt(inputCode);
    }
  }
  return friendsMessageTypeCode;
}
Program: 114312
Project: 114312
Buggy source:
public static QBChatMessage createMessageToPrivateChatAboutCreatingGroupChat(QBDialog dialog,String body){
  String occupantsIds=ChatUtils.getOccupantsIdsStringFromList(dialog.getOccupants());
  QBChatMessage chatMessage=new QBChatMessage();
  chatMessage.setBody(body);
  chatMessage.setProperty(PROPERTY_NOTIFICATION_TYPE,PROPERTY_TYPE_TO_PRIVATE_CHAT__GROUP_CHAT_CREATE);
  chatMessage.setProperty(PROPERTY_OCCUPANTS_IDS,occupantsIds);
  chatMessage.setProperty(PROPERTY_ROOM_JID,dialog.getRoomJid());
  chatMessage.setProperty(PROPERTY_ROOM_NAME,dialog.getName());
  return chatMessage;
}

Fixed version (ground truth):
public static QBChatMessage createMessageToPrivateChatAboutCreatingGroupChat(QBDialog dialog,String body){
  String occupantsIds=ChatUtils.getOccupantsIdsStringFromList(dialog.getOccupants());
  QBChatMessage chatMessage=new QBChatMessage();
  chatMessage.setBody(body);
  chatMessage.setProperty(PROPERTY_NOTIFICATION_TYPE,PROPERTY_TYPE_TO_GROUP_CHAT__GROUP_CHAT_CREATE);
  chatMessage.setProperty(PROPERTY_OCCUPANTS_IDS,occupantsIds);
  chatMessage.setProperty(PROPERTY_ROOM_JID,dialog.getRoomJid());
  chatMessage.setProperty(PROPERTY_ROOM_NAME,dialog.getName());
  return chatMessage;
}
Program: 114314
Project: 114314
Buggy source:
private void saveOpeningDialogData(int userId,String dialogId){
  if (userId != ConstsCore.ZERO_INT_VALUE && !TextUtils.isEmpty(dialogId)) {
    PrefsHelper prefsHelper=PrefsHelper.getPrefsHelper();
    prefsHelper.savePref(PrefsHelper.PREF_PUSH_MESSAGE_NEED_TO_OPEN_DIALOG,true);
    prefsHelper.savePref(PrefsHelper.PREF_PUSH_MESSAGE_USER_ID,userId);
    prefsHelper.savePref(PrefsHelper.PREF_PUSH_MESSAGE_DIALOG_ID,dialogId);
  }
}

Fixed version (ground truth):
private void saveOpeningDialogData(int userId,String dialogId){
  if (userId != ConstsCore.ZERO_INT_VALUE && !TextUtils.isEmpty(dialogId)) {
    PrefsHelper prefsHelper=PrefsHelper.getPrefsHelper();
    prefsHelper.savePref(PrefsHelper.PREF_PUSH_MESSAGE_USER_ID,userId);
    prefsHelper.savePref(PrefsHelper.PREF_PUSH_MESSAGE_DIALOG_ID,dialogId);
  }
}
Program: 114315
Project: 114315
Buggy source:
private void sendNotification(){
  notificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  Intent intent=new Intent(this,SplashActivity.class);
  saveOpeningDialogData(userId,dialogId);
  PendingIntent contentIntent=PendingIntent.getActivity(this,ConstsCore.ZERO_INT_VALUE,intent,PendingIntent.FLAG_UPDATE_CURRENT);
  NotificationCompat.Builder builder=new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_launcher).setContentTitle(getString(R.string.push_title)).setStyle(new NotificationCompat.BigTextStyle().bigText(message)).setContentText(message).setVibrate(new long[]{ConstsCore.ZERO_INT_VALUE,VIBRATOR_DURATION});
  builder.setAutoCancel(true);
  builder.setContentIntent(contentIntent);
  builder.getNotification().flags|=Notification.FLAG_AUTO_CANCEL;
  notificationManager.notify(NOTIFICATION_ID,builder.build());
}

Fixed version (ground truth):
private void sendNotification(){
  notificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  Intent intent=new Intent(this,SplashActivity.class);
  intent.putExtra(CLICKED_ON_PUSH,true);
  saveOpeningDialogData(userId,dialogId);
  PendingIntent contentIntent=PendingIntent.getActivity(this,ConstsCore.ZERO_INT_VALUE,intent,PendingIntent.FLAG_UPDATE_CURRENT);
  NotificationCompat.Builder builder=new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_launcher).setContentTitle(getString(R.string.push_title)).setStyle(new NotificationCompat.BigTextStyle().bigText(message)).setContentText(message).setVibrate(new long[]{ConstsCore.ZERO_INT_VALUE,VIBRATOR_DURATION});
  builder.setAutoCancel(true);
  builder.setContentIntent(contentIntent);
  builder.getNotification().flags|=Notification.FLAG_AUTO_CANCEL;
  notificationManager.notify(NOTIFICATION_ID,builder.build());
}
Program: 114316
Project: 114316
Buggy source:
public void sendMessageOnClick(View view){
  try {
    ((QBMultiChatHelper)baseChatHelper).sendGroupMessage(dialog.getRoomJid(),messageEditText.getText().toString());
  }
 catch (  QBResponseException e) {
    ErrorUtils.showError(this,e);
  }
  messageEditText.setText(ConstsCore.EMPTY_STRING);
  isNeedToScrollMessages=true;
  scrollListView();
}

Fixed version (ground truth):
public void sendMessageOnClick(View view){
  sendMessage(false);
}
Program: 114317
Project: 114317
Buggy source:
public void sendMessageOnClick(View view){
  try {
    ((QBPrivateChatHelper)baseChatHelper).sendPrivateMessage(messageEditText.getText().toString(),opponentFriend.getUserId());
  }
 catch (  QBResponseException exc) {
    ErrorUtils.showError(this,exc);
  }
  messageEditText.setText(ConstsCore.EMPTY_STRING);
  isNeedToScrollMessages=true;
  scrollListView();
}

Fixed version (ground truth):
public void sendMessageOnClick(View view){
  sendMessage(true);
}
Program: 114318
Project: 114318
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Crashlytics.start(this);
  addActions();
  facebookHelper=new FacebookHelper(this,savedInstanceState,new FacebookSessionStatusCallback());
  String userEmail=PrefsHelper.getPrefsHelper().getPref(PrefsHelper.PREF_USER_EMAIL);
  String userPassword=PrefsHelper.getPrefsHelper().getPref(PrefsHelper.PREF_USER_PASSWORD);
  boolean isRememberMe=PrefsHelper.getPrefsHelper().getPref(PrefsHelper.PREF_REMEMBER_ME,false);
  if (isRememberMe) {
    checkStartExistSession(userEmail,userPassword);
  }
 else {
    startLanding();
  }
  setContentView(R.layout.activity_splash);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Crashlytics.start(this);
  addActions();
  facebookHelper=new FacebookHelper(this,savedInstanceState,new FacebookSessionStatusCallback());
  String userEmail=PrefsHelper.getPrefsHelper().getPref(PrefsHelper.PREF_USER_EMAIL);
  String userPassword=PrefsHelper.getPrefsHelper().getPref(PrefsHelper.PREF_USER_PASSWORD);
  boolean isRememberMe=PrefsHelper.getPrefsHelper().getPref(PrefsHelper.PREF_REMEMBER_ME,false);
  if (getIntent().hasExtra(GCMIntentService.CLICKED_ON_PUSH)) {
    PrefsHelper.getPrefsHelper().savePref(PrefsHelper.PREF_PUSH_MESSAGE_NEED_TO_OPEN_DIALOG,true);
  }
  if (isRememberMe) {
    checkStartExistSession(userEmail,userPassword);
  }
 else {
    startLanding();
  }
  setContentView(R.layout.activity_splash);
}
Program: 114319
Project: 114319
Buggy source:
private void sendGroupMessage(QBChatMessage chatMessage,String roomJId,String dialogId) throws QBResponseException {
  QBGroupChat groupChat=groupChatManager.getGroupChat(roomJId);
  QBDialog existingDialog=null;
  if (groupChat == null) {
    existingDialog=ChatDatabaseManager.getDialogByDialogId(context,dialogId);
    groupChat=(QBGroupChat)createChatLocally(existingDialog,null);
  }
  String error=null;
  addNecessaryPropertyForQBChatMessage(chatMessage,dialogId);
  try {
    groupChat.sendMessage(chatMessage);
  }
 catch (  XMPPException e) {
    error=context.getString(R.string.dlg_fail_send_msg);
  }
catch (  SmackException.NotConnectedException e) {
    error=context.getString(R.string.dlg_fail_connection);
  }
catch (  IllegalStateException e) {
    ErrorUtils.showError(context,context.getString(R.string.dlg_not_joined_room));
    tryJoinRoomChat(existingDialog);
  }
  if (error != null) {
    throw new QBResponseException(error);
  }
}

Fixed version (ground truth):
private void sendGroupMessage(QBChatMessage chatMessage,String roomJId,String dialogId) throws QBResponseException {
  QBGroupChat groupChat=groupChatManager.getGroupChat(roomJId);
  QBDialog existingDialog=null;
  if (groupChat == null) {
    existingDialog=ChatDatabaseManager.getDialogByDialogId(context,dialogId);
    groupChat=(QBGroupChat)createChatLocally(existingDialog,null);
  }
  String error=null;
  addNecessaryPropertyForQBChatMessage(chatMessage,dialogId);
  try {
    groupChat.sendMessage(chatMessage);
  }
 catch (  XMPPException e) {
    error=context.getString(R.string.dlg_fail_send_msg);
  }
catch (  SmackException.NotConnectedException e) {
    error=context.getString(R.string.dlg_fail_connection);
  }
catch (  IllegalStateException e) {
    tryJoinRoomChat(existingDialog);
    throw new IllegalStateException(e);
  }
  if (error != null) {
    throw new QBResponseException(error);
  }
}
Program: 114320
Project: 114320
Buggy source:
private void createMessageTable(SQLiteDatabase db){
  StringBuilder messageTableFields=new StringBuilder();
  messageTableFields.append(MessageTable.Cols.ID).append("String_Node_Str").append(MessageTable.Cols.MESSAGE_ID).append("String_Node_Str").append(MessageTable.Cols.DIALOG_ID).append("String_Node_Str").append(MessageTable.Cols.SENDER_ID).append("String_Node_Str").append(MessageTable.Cols.BODY).append("String_Node_Str").append(MessageTable.Cols.TIME).append("String_Node_Str").append(MessageTable.Cols.ATTACH_FILE_ID).append("String_Node_Str").append(MessageTable.Cols.IS_READ).append("String_Node_Str").append(MessageTable.Cols.IS_DELIVERED).append("String_Node_Str").append(MessageTable.Cols.IS_SYNC).append("String_Node_Str").append(MessageTable.Cols.FRIENDS_NOTIFICATION_TYPE).append("String_Node_Str");
  createTable(db,MessageTable.TABLE_NAME,messageTableFields.toString());
}

Fixed version (ground truth):
private void createMessageTable(SQLiteDatabase db){
  StringBuilder messageTableFields=new StringBuilder();
  messageTableFields.append(MessageTable.Cols.ID).append("String_Node_Str").append(MessageTable.Cols.MESSAGE_ID).append("String_Node_Str").append(MessageTable.Cols.DIALOG_ID).append("String_Node_Str").append(MessageTable.Cols.SENDER_ID).append("String_Node_Str").append(MessageTable.Cols.RECIPIENT_ID).append("String_Node_Str").append(MessageTable.Cols.BODY).append("String_Node_Str").append(MessageTable.Cols.TIME).append("String_Node_Str").append(MessageTable.Cols.ATTACH_FILE_ID).append("String_Node_Str").append(MessageTable.Cols.IS_READ).append("String_Node_Str").append(MessageTable.Cols.IS_DELIVERED).append("String_Node_Str").append(MessageTable.Cols.IS_SYNC).append("String_Node_Str").append(MessageTable.Cols.FRIENDS_NOTIFICATION_TYPE).append("String_Node_Str");
  createTable(db,MessageTable.TABLE_NAME,messageTableFields.toString());
}
Program: 114322
Project: 114322
Buggy source:
public static MessageCache getMessageCacheFromCursor(Cursor cursor){
  String id=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.MESSAGE_ID));
  String dialogId=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.DIALOG_ID));
  Integer senderId=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.SENDER_ID));
  String body=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.BODY));
  long time=cursor.getLong(cursor.getColumnIndex(MessageTable.Cols.TIME));
  String attachUrl=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.ATTACH_FILE_ID));
  boolean isRead=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.IS_READ)) > ConstsCore.ZERO_INT_VALUE;
  boolean isDelivered=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.IS_DELIVERED)) > ConstsCore.ZERO_INT_VALUE;
  boolean isSync=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.IS_SYNC)) > ConstsCore.ZERO_INT_VALUE;
  MessagesNotificationType messagesNotificationType=MessagesNotificationType.parseByCode(cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.FRIENDS_NOTIFICATION_TYPE)));
  MessageCache messageCache=new MessageCache(id,dialogId,senderId,body,attachUrl,time,isRead,isDelivered,isSync);
  messageCache.setMessagesNotificationType(messagesNotificationType);
  return messageCache;
}

Fixed version (ground truth):
public static MessageCache getMessageCacheFromCursor(Cursor cursor){
  String id=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.MESSAGE_ID));
  String dialogId=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.DIALOG_ID));
  Integer senderId=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.SENDER_ID));
  Integer recipientId=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.RECIPIENT_ID));
  String body=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.BODY));
  long time=cursor.getLong(cursor.getColumnIndex(MessageTable.Cols.TIME));
  String attachUrl=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.ATTACH_FILE_ID));
  boolean isRead=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.IS_READ)) > ConstsCore.ZERO_INT_VALUE;
  boolean isDelivered=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.IS_DELIVERED)) > ConstsCore.ZERO_INT_VALUE;
  boolean isSync=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.IS_SYNC)) > ConstsCore.ZERO_INT_VALUE;
  MessagesNotificationType messagesNotificationType=MessagesNotificationType.parseByCode(cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.FRIENDS_NOTIFICATION_TYPE)));
  MessageCache messageCache=new MessageCache(id,dialogId,senderId,recipientId,body,attachUrl,time,isRead,isDelivered,isSync);
  messageCache.setMessagesNotificationType(messagesNotificationType);
  return messageCache;
}
Program: 114323
Project: 114323
Buggy source:
public static void updateStatusMessage(Context context,MessageCache messageCache){
  ContentValues values=new ContentValues();
  String condition=MessageTable.Cols.MESSAGE_ID + "String_Node_Str" + messageCache.getId()+ "String_Node_Str";
  ContentResolver resolver=context.getContentResolver();
  Cursor cursor=resolver.query(MessageTable.CONTENT_URI,null,condition,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    String dialogId=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.DIALOG_ID));
    String message=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.BODY));
    long time=cursor.getLong(cursor.getColumnIndex(MessageTable.Cols.TIME));
    int lastSenderId=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.SENDER_ID));
    messageCache.setDialogId(dialogId);
    messageCache.setMessage(message);
    messageCache.setSenderId(lastSenderId);
    messageCache.setTime(time);
    values.put(MessageTable.Cols.IS_READ,messageCache.isRead());
    resolver.update(MessageTable.CONTENT_URI,values,condition,null);
    cursor.close();
    int countUnreadMessagesLocal=getCountUnreadMessagesByDialogIdLocal(context,messageCache.getDialogId());
    countUnreadMessagesLocal=--countUnreadMessagesLocal;
    checkUpdatingDialogForFriendsNotificationMessage(context,messageCache,countUnreadMessagesLocal);
  }
}

Fixed version (ground truth):
public static void updateStatusMessage(Context context,MessageCache messageCache){
  ContentValues values=new ContentValues();
  String condition=MessageTable.Cols.MESSAGE_ID + "String_Node_Str" + messageCache.getId()+ "String_Node_Str";
  ContentResolver resolver=context.getContentResolver();
  Cursor cursor=resolver.query(MessageTable.CONTENT_URI,null,condition,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    String dialogId=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.DIALOG_ID));
    String message=cursor.getString(cursor.getColumnIndex(MessageTable.Cols.BODY));
    long time=cursor.getLong(cursor.getColumnIndex(MessageTable.Cols.TIME));
    int lastSenderId=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.SENDER_ID));
    int recipientId=cursor.getInt(cursor.getColumnIndex(MessageTable.Cols.RECIPIENT_ID));
    messageCache.setDialogId(dialogId);
    messageCache.setMessage(message);
    messageCache.setSenderId(lastSenderId);
    messageCache.setRecipientId(recipientId);
    messageCache.setTime(time);
    values.put(MessageTable.Cols.IS_READ,messageCache.isRead());
    resolver.update(MessageTable.CONTENT_URI,values,condition,null);
    cursor.close();
    int countUnreadMessagesLocal=getCountUnreadMessagesByDialogIdLocal(context,messageCache.getDialogId());
    countUnreadMessagesLocal=--countUnreadMessagesLocal;
    checkUpdatingDialogForFriendsNotificationMessage(context,messageCache,countUnreadMessagesLocal);
  }
}