nus-yam/ex-repair huggingface dataset:
Program: 114324
Project: 114324
Buggy source:
private static void saveChatMessage(Context context,MessageCache messageCache){
  ContentValues values=new ContentValues();
  MessagesNotificationType messagesNotificationType=messageCache.getMessagesNotificationType();
  messageCache.setMessage(parseMessageBody(context,messageCache));
  values.put(MessageTable.Cols.BODY,messageCache.getMessage());
  values.put(MessageTable.Cols.TIME,messageCache.getTime());
  values.put(MessageTable.Cols.ATTACH_FILE_ID,messageCache.getAttachUrl());
  values.put(MessageTable.Cols.IS_READ,messageCache.isRead());
  values.put(MessageTable.Cols.IS_DELIVERED,messageCache.isDelivered());
  values.put(MessageTable.Cols.IS_SYNC,messageCache.isSync());
  values.put(MessageTable.Cols.FRIENDS_NOTIFICATION_TYPE,messagesNotificationType == null ? ConstsCore.ZERO_INT_VALUE : messagesNotificationType.getCode());
  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.getCount() > ConstsCore.ZERO_INT_VALUE) {
    resolver.update(MessageTable.CONTENT_URI,values,condition,null);
  }
 else {
    values.put(MessageTable.Cols.MESSAGE_ID,messageCache.getId());
    values.put(MessageTable.Cols.DIALOG_ID,messageCache.getDialogId());
    values.put(MessageTable.Cols.SENDER_ID,messageCache.getSenderId());
    resolver.insert(MessageTable.CONTENT_URI,values);
  }
}

Fixed version (ground truth):
private static void saveChatMessage(Context context,MessageCache messageCache){
  ContentValues values=new ContentValues();
  MessagesNotificationType messagesNotificationType=messageCache.getMessagesNotificationType();
  messageCache.setMessage(parseMessageBody(context,messageCache));
  values.put(MessageTable.Cols.BODY,messageCache.getMessage());
  values.put(MessageTable.Cols.TIME,messageCache.getTime());
  values.put(MessageTable.Cols.ATTACH_FILE_ID,messageCache.getAttachUrl());
  values.put(MessageTable.Cols.IS_READ,messageCache.isRead());
  values.put(MessageTable.Cols.IS_DELIVERED,messageCache.isDelivered());
  values.put(MessageTable.Cols.IS_SYNC,messageCache.isSync());
  values.put(MessageTable.Cols.FRIENDS_NOTIFICATION_TYPE,messagesNotificationType == null ? ConstsCore.ZERO_INT_VALUE : messagesNotificationType.getCode());
  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.getCount() > ConstsCore.ZERO_INT_VALUE) {
    resolver.update(MessageTable.CONTENT_URI,values,condition,null);
  }
 else {
    values.put(MessageTable.Cols.MESSAGE_ID,messageCache.getId());
    values.put(MessageTable.Cols.DIALOG_ID,messageCache.getDialogId());
    values.put(MessageTable.Cols.SENDER_ID,messageCache.getSenderId());
    values.put(MessageTable.Cols.RECIPIENT_ID,messageCache.getRecipientId());
    resolver.insert(MessageTable.CONTENT_URI,values);
  }
}
Program: 114325
Project: 114325
Buggy source:
public MessageCache(String id,String dialogId,Integer senderId,String message,String attachUrl,long time,boolean isRead,boolean isDelivered,boolean isSync){
  this.id=id;
  this.dialogId=dialogId;
  this.senderId=senderId;
  this.message=message;
  this.attachUrl=attachUrl;
  this.time=time;
  this.isRead=isRead;
  this.isDelivered=isDelivered;
  this.isSync=isSync;
}

Fixed version (ground truth):
public MessageCache(String id,String dialogId,Integer senderId,Integer recipientId,String message,String attachUrl,long time,boolean isRead,boolean isDelivered,boolean isSync){
  this.id=id;
  this.dialogId=dialogId;
  this.senderId=senderId;
  this.recipientId=recipientId;
  this.message=message;
  this.attachUrl=attachUrl;
  this.time=time;
  this.isRead=isRead;
  this.isDelivered=isDelivered;
  this.isSync=isSync;
}
Program: 114326
Project: 114326
Buggy source:
private void savePrivateMessageToCache(QBChatMessage chatMessage,String dialogId){
  String messageId=chatMessage.getId();
  long time=Long.parseLong(chatMessage.getProperty(ChatNotificationUtils.PROPERTY_DATE_SENT).toString());
  String attachUrl=ChatUtils.getAttachUrlFromMessage(new ArrayList<QBAttachment>(chatMessage.getAttachments()));
  MessageCache messageCache=new MessageCache(messageId,dialogId,chatCreator.getId(),chatMessage.getBody(),attachUrl,time,false,false,true);
  if (ChatNotificationUtils.isNotificationMessage(chatMessage)) {
    int friendsMessageTypeCode=ChatNotificationUtils.getNotificationTypeIfExist(chatMessage);
    messageCache.setMessagesNotificationType(MessagesNotificationType.parseByCode(friendsMessageTypeCode));
  }
  saveMessageToCache(messageCache);
}

Fixed version (ground truth):
private void savePrivateMessageToCache(QBChatMessage chatMessage,String dialogId){
  String messageId=chatMessage.getId();
  long time=Long.parseLong(chatMessage.getProperty(ChatNotificationUtils.PROPERTY_DATE_SENT).toString());
  String attachUrl=ChatUtils.getAttachUrlFromMessage(new ArrayList<QBAttachment>(chatMessage.getAttachments()));
  Integer recipientId;
  if (chatMessage.getRecipientId() == null) {
    recipientId=ConstsCore.ZERO_INT_VALUE;
  }
 else {
    recipientId=chatMessage.getRecipientId();
  }
  MessageCache messageCache=new MessageCache(messageId,dialogId,chatCreator.getId(),recipientId,chatMessage.getBody(),attachUrl,time,false,false,true);
  if (ChatNotificationUtils.isNotificationMessage(chatMessage)) {
    int friendsMessageTypeCode=ChatNotificationUtils.getNotificationTypeIfExist(chatMessage);
    messageCache.setMessagesNotificationType(MessagesNotificationType.parseByCode(friendsMessageTypeCode));
  }
  saveMessageToCache(messageCache);
}
Program: 114327
Project: 114327
Buggy source:
protected MessageCache parseReceivedMessage(QBChatMessage chatMessage){
  long time;
  String attachUrl;
  time=Long.parseLong(chatMessage.getProperty(ChatNotificationUtils.PROPERTY_DATE_SENT));
  attachUrl=ChatUtils.getAttachUrlIfExists(chatMessage);
  String dialogId=chatMessage.getProperty(ChatNotificationUtils.PROPERTY_DIALOG_ID);
  MessageCache messageCache=new MessageCache(chatMessage.getId(),dialogId,chatMessage.getSenderId(),chatMessage.getBody(),attachUrl,time,false,false,false);
  return messageCache;
}

Fixed version (ground truth):
protected MessageCache parseReceivedMessage(QBChatMessage chatMessage){
  long time;
  String attachUrl;
  time=Long.parseLong(chatMessage.getProperty(ChatNotificationUtils.PROPERTY_DATE_SENT));
  attachUrl=ChatUtils.getAttachUrlIfExists(chatMessage);
  String dialogId=chatMessage.getProperty(ChatNotificationUtils.PROPERTY_DIALOG_ID);
  Integer recipientId;
  if (chatMessage.getRecipientId() == null) {
    recipientId=ConstsCore.ZERO_INT_VALUE;
  }
 else {
    recipientId=chatMessage.getRecipientId();
  }
  MessageCache messageCache=new MessageCache(chatMessage.getId(),dialogId,chatMessage.getSenderId(),recipientId,chatMessage.getBody(),attachUrl,time,false,false,false);
  return messageCache;
}
Program: 114328
Project: 114328
Buggy source:
public static String getBodyForFriendsNotificationMessage(Context context,MessagesNotificationType messagesNotificationType,MessageCache messageCache){
  Resources resources=context.getResources();
  String resultMessage=resources.getString(R.string.frl_friends_contact_request);
  QBUser user=AppSession.getSession().getUser();
  boolean ownMessage=user.getId().equals(messageCache.getSenderId());
switch (messagesNotificationType) {
case FRIENDS_REQUEST:
{
      resultMessage=ownMessage ? resources.getString(R.string.frl_friends_request_message_for_me) : resources.getString(R.string.frl_friends_request_message_for_friend,ChatUtils.getFullNameById(context,messageCache.getSenderId()));
      break;
    }
case FRIENDS_ACCEPT:
{
    resultMessage=ownMessage ? resources.getString(R.string.frl_friends_request_accept_message_for_me) : resources.getString(R.string.frl_friends_request_accept_message_for_friend);
    break;
  }
case FRIENDS_REJECT:
{
  resultMessage=ownMessage ? resources.getString(R.string.frl_friends_request_reject_message_for_me) : resources.getString(R.string.frl_friends_request_reject_message_for_friend);
  break;
}
case FRIENDS_REMOVE:
{
resultMessage=ownMessage ? resources.getString(R.string.frl_friends_request_remove_message_for_me,user.getFullName()) : resources.getString(R.string.frl_friends_request_remove_message_for_friend,ChatUtils.getFullNameById(context,messageCache.getSenderId()));
break;
}
}
return resultMessage;
}

Fixed version (ground truth):
public static String getBodyForFriendsNotificationMessage(Context context,MessagesNotificationType messagesNotificationType,MessageCache messageCache){
  Resources resources=context.getResources();
  String resultMessage=resources.getString(R.string.frl_friends_contact_request);
  QBUser user=AppSession.getSession().getUser();
  boolean ownMessage=user.getId().equals(messageCache.getSenderId());
switch (messagesNotificationType) {
case FRIENDS_REQUEST:
{
      resultMessage=ownMessage ? resources.getString(R.string.frl_friends_request_message_for_me) : resources.getString(R.string.frl_friends_request_message_for_friend,ChatUtils.getFullNameById(context,messageCache.getSenderId()));
      break;
    }
case FRIENDS_ACCEPT:
{
    resultMessage=ownMessage ? resources.getString(R.string.frl_friends_request_accept_message_for_me) : resources.getString(R.string.frl_friends_request_accept_message_for_friend);
    break;
  }
case FRIENDS_REJECT:
{
  resultMessage=ownMessage ? resources.getString(R.string.frl_friends_request_reject_message_for_me) : resources.getString(R.string.frl_friends_request_reject_message_for_friend);
  break;
}
case FRIENDS_REMOVE:
{
User deletedUser=UsersDatabaseManager.getUserById(context,messageCache.getRecipientId());
String fullName;
if (deletedUser == null) {
  fullName=ChatUtils.getFullNameById(context,messageCache.getRecipientId());
}
 else {
  fullName=deletedUser.getFullName();
}
resultMessage=ownMessage ? resources.getString(R.string.frl_friends_request_remove_message_for_me,fullName) : resources.getString(R.string.frl_friends_request_remove_message_for_friend,fullName);
break;
}
}
return resultMessage;
}
Program: 114330
Project: 114330
Buggy source:
public static boolean deleteUserById(Context context,int userId){
  int deletedRow=context.getContentResolver().delete(FriendTable.CONTENT_URI,FriendTable.Cols.USER_ID + "String_Node_Str" + userId,null);
  return deletedRow > Consts.ZERO_INT_VALUE;
}

Fixed version (ground truth):
public static boolean deleteUserById(Context context,int userId){
  int deletedRow=context.getContentResolver().delete(UserTable.CONTENT_URI,UserTable.Cols.USER_ID + "String_Node_Str" + userId,null);
  return deletedRow > Consts.ZERO_INT_VALUE;
}
Program: 114331
Project: 114331
Buggy source:
private void createFriend(int userId,boolean requestedFriend) throws QBResponseException {
  Log.d("String_Node_Str","String_Node_Str" + requestedFriend);
  User user=restHelper.loadUser(userId);
  Friend friend=FriendUtils.createFriend(userId,requestedFriend);
  fillUserOnlineStatus(user);
  saveUser(user);
  saveFriend(friend);
  Log.d("String_Node_Str","String_Node_Str" + requestedFriend + "String_Node_Str");
}

Fixed version (ground truth):
private void createFriend(int userId,boolean requestedFriend) throws QBResponseException {
  User user=restHelper.loadUser(userId);
  Friend friend=FriendUtils.createFriend(userId,requestedFriend);
  fillUserOnlineStatus(user);
  saveUser(user);
  saveFriend(friend);
}
Program: 114332
Project: 114332
Buggy source:
@Override public void subscriptionRequested(int userId){
  Log.d("String_Node_Str","String_Node_Str");
  try {
    createFriend(userId,true);
    notifyContactRequest();
  }
 catch (  QBResponseException e) {
    Log.e(TAG,SUBSCRIPTION_ERROR,e);
  }
}

Fixed version (ground truth):
@Override public void subscriptionRequested(int userId){
  try {
    createFriend(userId,true);
    notifyContactRequest();
  }
 catch (  QBResponseException e) {
    Log.e(TAG,SUBSCRIPTION_ERROR,e);
  }
}
Program: 114333
Project: 114333
Buggy source:
@Override public void entriesAdded(Collection<Integer> userIdsList){
  Log.d("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Override public void entriesAdded(Collection<Integer> userIdsList){
}
Program: 114334
Project: 114334
Buggy source:
public void init(){
  roster=QBChatService.getInstance().getRoster(QBRoster.SubscriptionMode.mutual,new SubscriptionListener());
  roster.setSubscriptionMode(QBRoster.SubscriptionMode.mutual);
  roster.addRosterListener(new RosterListener());
  restHelper=new QBRestHelper(context);
}

Fixed version (ground truth):
public void init(){
  restHelper=new QBRestHelper(context);
  roster=QBChatService.getInstance().getRoster(QBRoster.SubscriptionMode.mutual,new SubscriptionListener());
  roster.setSubscriptionMode(QBRoster.SubscriptionMode.mutual);
  roster.addRosterListener(new RosterListener());
}
Program: 114335
Project: 114335
Buggy source:
private void updateFriend(int userId) throws QBResponseException {
  QBRosterEntry rosterEntry=roster.getEntry(userId);
  User user=restHelper.loadUser(userId);
  if (user == null) {
    return;
  }
  Friend friend=FriendUtils.createFriend(rosterEntry);
  fillUserOnlineStatus(user);
  Friend oldFriend=DatabaseManager.getFriendById(context,friend.getUserId());
  if (oldFriend != null) {
    checkAlertShowing(friend,oldFriend);
  }
  saveUser(user);
  saveFriend(friend);
}

Fixed version (ground truth):
private void updateFriend(int userId) throws QBResponseException {
  QBRosterEntry rosterEntry=roster.getEntry(userId);
  User user=restHelper.loadUser(userId);
  if (user == null) {
    return;
  }
  Friend friend=FriendUtils.createFriend(rosterEntry);
  Friend oldFriend=DatabaseManager.getFriendById(context,friend.getUserId());
  saveUser(user);
  saveFriend(friend);
  if (oldFriend != null) {
    checkAlertShowing(friend,oldFriend);
  }
  fillUserOnlineStatus(user);
}
Program: 114336
Project: 114336
Buggy source:
@Override public void entriesUpdated(Collection<Integer> userIdsList){
  try {
    Log.d("String_Node_Str","String_Node_Str");
    updateFriends(userIdsList);
  }
 catch (  QBResponseException e) {
    Log.e(TAG,ENTRIES_UPDATING_ERROR,e);
  }
}

Fixed version (ground truth):
@Override public void entriesUpdated(Collection<Integer> userIdsList){
  try {
    updateFriends(userIdsList);
  }
 catch (  QBResponseException e) {
    Log.e(TAG,ENTRIES_UPDATING_ERROR,e);
  }
}
Program: 114337
Project: 114337
Buggy source:
@Override public void entriesDeleted(Collection<Integer> userIdsList){
  try {
    Log.d("String_Node_Str","String_Node_Str");
    deleteUsers(userIdsList);
  }
 catch (  QBResponseException e) {
    Log.e(TAG,ENTRIES_DELETED_ERROR,e);
  }
}

Fixed version (ground truth):
@Override public void entriesDeleted(Collection<Integer> userIdsList){
  try {
    deleteUsers(userIdsList);
  }
 catch (  QBResponseException e) {
    Log.e(TAG,ENTRIES_DELETED_ERROR,e);
  }
}
Program: 114338
Project: 114338
Buggy source:
private void checkAlertShowing(Friend newFriend,Friend oldFriend){
  String alertMessage=null;
  String friendName=DatabaseManager.getUserById(context,newFriend.getUserId()).getFullName();
  boolean friendRejectedMe=oldFriend.isAskStatus() && !newFriend.isAskStatus() && newFriend.getRelationStatus().equals(RELATION_STATUS_NONE);
  boolean friendAcceptedMe=oldFriend.isAskStatus() && newFriend.getRelationStatus().equals(RELATION_STATUS_TO);
  boolean friendDeletedMe=(oldFriend.getRelationStatus().equals(RELATION_STATUS_TO) || oldFriend.getRelationStatus().equals(RELATION_STATUS_FROM) || oldFriend.getRelationStatus().equals(RELATION_STATUS_BOTH)) && newFriend.getRelationStatus().equals(RELATION_STATUS_NONE);
  if (friendRejectedMe) {
    alertMessage=context.getString(R.string.frl_alrt_reject_friend,friendName);
  }
 else   if (friendAcceptedMe) {
    alertMessage=context.getString(R.string.frl_alrt_accepted_friend,friendName);
  }
 else   if (friendDeletedMe) {
    alertMessage=context.getString(R.string.frl_alrt_deleted_friend,friendName);
  }
  if (alertMessage != null) {
    notifyFriendAlert(alertMessage);
  }
}

Fixed version (ground truth):
private void checkAlertShowing(Friend newFriend,Friend oldFriend){
  String alertMessage=null;
  String friendName=DatabaseManager.getUserById(context,newFriend.getUserId()).getFullName();
  boolean friendRejectedMe=oldFriend.isAskStatus() && !newFriend.isAskStatus() && newFriend.getRelationStatus().equals(RELATION_STATUS_NONE);
  boolean friendAcceptedMe=oldFriend.isAskStatus() && newFriend.getRelationStatus().equals(RELATION_STATUS_TO);
  boolean friendDeletedMe=(oldFriend.getRelationStatus().equals(RELATION_STATUS_TO) || oldFriend.getRelationStatus().equals(RELATION_STATUS_FROM) || oldFriend.getRelationStatus().equals(RELATION_STATUS_BOTH)) && newFriend.getRelationStatus().equals(RELATION_STATUS_NONE);
  if (friendRejectedMe || friendDeletedMe) {
    try {
      clearRosterEntry(newFriend.getUserId());
      deleteUser(newFriend.getUserId());
    }
 catch (    Exception e) {
      ErrorUtils.logError(e);
    }
    if (friendRejectedMe) {
      alertMessage=context.getString(R.string.frl_alrt_reject_friend,friendName);
    }
 else     if (friendDeletedMe) {
      alertMessage=context.getString(R.string.frl_alrt_deleted_friend,friendName);
    }
  }
 else   if (friendAcceptedMe) {
    alertMessage=context.getString(R.string.frl_alrt_accepted_friend,friendName);
  }
  if (alertMessage != null) {
    notifyFriendAlert(alertMessage);
  }
}
Program: 114339
Project: 114339
Buggy source:
private void getFacebookFriendsList(){
  Request.executeMyFriendsRequestAsync(Session.getActiveSession(),new Request.GraphUserListCallback(){
    @Override public void onCompleted(    List<com.facebook.model.GraphUser> users,    Response response){
      for (      com.facebook.model.GraphUser user : users) {
        friendsFacebookList.add(new InviteFriend(user.getId(),user.getName(),user.getLink(),InviteFriend.VIA_FACEBOOK_TYPE,null,false));
      }
      fiendsReceived();
    }
  }
);
}

Fixed version (ground truth):
private void getFacebookFriendsList(){
  Request.newMyFriendsRequest(Session.getActiveSession(),new Request.GraphUserListCallback(){
    @Override public void onCompleted(    List<GraphUser> users,    Response response){
      for (      com.facebook.model.GraphUser user : users) {
        friendsFacebookList.add(new InviteFriend(user.getId(),user.getName(),user.getLink(),InviteFriend.VIA_FACEBOOK_TYPE,null,false));
      }
      fiendsReceived();
    }
  }
).executeAsync();
}
Program: 114340
Project: 114340
Buggy source:
@Override public void onCompleted(List<com.facebook.model.GraphUser> users,Response response){
  for (  com.facebook.model.GraphUser user : users) {
    friendsFacebookList.add(new InviteFriend(user.getId(),user.getName(),user.getLink(),InviteFriend.VIA_FACEBOOK_TYPE,null,false));
  }
  fiendsReceived();
}

Fixed version (ground truth):
@Override public void onCompleted(List<GraphUser> users,Response response){
  for (  com.facebook.model.GraphUser user : users) {
    friendsFacebookList.add(new InviteFriend(user.getId(),user.getName(),user.getLink(),InviteFriend.VIA_FACEBOOK_TYPE,null,false));
  }
  fiendsReceived();
}
Program: 114341
Project: 114341
Buggy source:
public void loginWithFacebook(){
  TipsManager.setIsJustLogined(true);
  Session session=Session.getActiveSession();
  if (!session.isOpened() && !session.isClosed()) {
    session.openForRead(new Session.OpenRequest(activity).setCallback(facebookStatusCallback));
  }
 else {
    Session.openActiveSession(activity,true,facebookStatusCallback);
  }
}

Fixed version (ground truth):
public void loginWithFacebook(){
  TipsManager.setIsJustLogined(true);
  Session session=Session.getActiveSession();
  if (!session.isOpened() && !session.isClosed()) {
    session.openForRead(new Session.OpenRequest(activity).setPermissions(Arrays.asList("String_Node_Str")).setCallback(facebookStatusCallback));
  }
 else {
    Session.openActiveSession(activity,true,facebookStatusCallback);
  }
}
Program: 114342
Project: 114342
Buggy source:
private void setOnlineStatus(User friend){
  if (friend.isOnline()) {
    onlineImageView.setVisibility(View.VISIBLE);
  }
 else {
    onlineImageView.setVisibility(View.GONE);
  }
  statusTextView.setText(friend.getStatus());
  onlineStatusTextView.setText(friend.getOnlineStatus());
}

Fixed version (ground truth):
private void setOnlineStatus(User friend){
  if (friend != null) {
    if (friend.isOnline()) {
      onlineImageView.setVisibility(View.VISIBLE);
    }
 else {
      onlineImageView.setVisibility(View.GONE);
    }
    statusTextView.setText(friend.getStatus());
    onlineStatusTextView.setText(friend.getOnlineStatus());
  }
}
Program: 114343
Project: 114343
Buggy source:
public static void saveChatMessage(Context context,MessageCache messageCache){
  ContentValues values=new ContentValues();
  String body=messageCache.getMessage();
  values.put(MessageTable.Cols.ID,messageCache.getId());
  values.put(MessageTable.Cols.DIALOG_ID,messageCache.getDialogId());
  values.put(MessageTable.Cols.PACKET_ID,messageCache.getPacketId());
  values.put(MessageTable.Cols.SENDER_ID,messageCache.getSenderId());
  if (TextUtils.isEmpty(body)) {
    values.put(MessageTable.Cols.BODY,body);
  }
 else {
    values.put(MessageTable.Cols.BODY,Html.fromHtml(body).toString());
  }
  if (messageCache.getFriendsNotificationType() != null) {
    values.put(MessageTable.Cols.FRIENDS_NOTIFICATION_TYPE,messageCache.getFriendsNotificationType().getCode());
  }
  values.put(MessageTable.Cols.TIME,messageCache.getTime());
  values.put(MessageTable.Cols.ATTACH_FILE_ID,messageCache.getAttachUrl());
  values.put(MessageTable.Cols.IS_READ,messageCache.isRead());
  values.put(MessageTable.Cols.IS_DELIVERED,messageCache.isDelivered());
  context.getContentResolver().insert(MessageTable.CONTENT_URI,values);
  int countUnreadMessagesLocal=getCountUnreadMessagesByDialogIdLocal(context,messageCache.getDialogId());
  if (!messageCache.isRead()) {
    countUnreadMessagesLocal=++countUnreadMessagesLocal;
  }
  updateDialog(context,messageCache.getDialogId(),messageCache.getMessage(),messageCache.getTime(),messageCache.getSenderId(),countUnreadMessagesLocal);
}

Fixed version (ground truth):
public static void saveChatMessage(Context context,MessageCache messageCache){
  ContentValues values=new ContentValues();
  values.put(MessageTable.Cols.ID,messageCache.getId());
  values.put(MessageTable.Cols.DIALOG_ID,messageCache.getDialogId());
  values.put(MessageTable.Cols.PACKET_ID,messageCache.getPacketId());
  values.put(MessageTable.Cols.SENDER_ID,messageCache.getSenderId());
  if (messageCache.getFriendsNotificationType() != null) {
    values.put(MessageTable.Cols.FRIENDS_NOTIFICATION_TYPE,messageCache.getFriendsNotificationType().getCode());
  }
  values.put(MessageTable.Cols.BODY,parseMessageBody(context,messageCache));
  values.put(MessageTable.Cols.TIME,messageCache.getTime());
  values.put(MessageTable.Cols.ATTACH_FILE_ID,messageCache.getAttachUrl());
  values.put(MessageTable.Cols.IS_READ,messageCache.isRead());
  values.put(MessageTable.Cols.IS_DELIVERED,messageCache.isDelivered());
  context.getContentResolver().insert(MessageTable.CONTENT_URI,values);
  int countUnreadMessagesLocal=getCountUnreadMessagesByDialogIdLocal(context,messageCache.getDialogId());
  if (!messageCache.isRead()) {
    countUnreadMessagesLocal=++countUnreadMessagesLocal;
  }
  updateDialog(context,messageCache.getDialogId(),messageCache.getMessage(),messageCache.getTime(),messageCache.getSenderId(),countUnreadMessagesLocal);
}
Program: 114344
Project: 114344
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;
    String friendsMessageType;
    attachURL=ChatUtils.getAttachUrlFromMessage(historyMessage.getAttachments());
    messageCache=new MessageCache(messageId,dialogId,null,senderId,message,attachURL,time,true,true);
    if (historyMessage.getProperty(ChatUtils.PROPERTY_NOTIFICATION_TYPE) != null) {
      friendsMessageType=historyMessage.getProperty(ChatUtils.PROPERTY_NOTIFICATION_TYPE).toString();
      if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_REQUEST.equals(friendsMessageType)) {
        messageCache.setFriendsNotificationType(FriendsNotificationType.REQUEST);
      }
    }
    saveChatMessage(context,messageCache);
  }
  if (messageCache != null) {
    updateDialog(context,messageCache.getDialogId(),messageCache.getMessage(),messageCache.getTime(),messageCache.getSenderId(),Consts.ZERO_INT_VALUE);
  }
}

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,null,senderId,message,attachURL,time,true,true);
    if (historyMessage.getProperty(ChatUtils.PROPERTY_NOTIFICATION_TYPE) != null) {
      friendsMessageTypeCode=Integer.parseInt(historyMessage.getProperty(ChatUtils.PROPERTY_NOTIFICATION_TYPE).toString());
      if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_REQUEST.equals(friendsMessageTypeCode + Consts.EMPTY_STRING) || ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_ACCEPT_REQUEST.equals(friendsMessageTypeCode + Consts.EMPTY_STRING) || ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_REJECT_REQUEST.equals(friendsMessageTypeCode + Consts.EMPTY_STRING)|| ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_REMOVE_REQUEST.equals(friendsMessageTypeCode + Consts.EMPTY_STRING)) {
        messageCache.setFriendsNotificationType(FriendsNotificationType.parseByCode(friendsMessageTypeCode));
      }
    }
    saveChatMessage(context,messageCache);
  }
  if (messageCache != null) {
    updateDialog(context,messageCache.getDialogId(),messageCache.getMessage(),messageCache.getTime(),messageCache.getSenderId(),Consts.ZERO_INT_VALUE);
  }
}
Program: 114345
Project: 114345
Buggy source:
private void sendNotificationToFriend(int userId) throws QBResponseException {
  QBDialog existingPrivateDialog=ChatUtils.getExistPrivateDialog(context,userId);
  if (existingPrivateDialog == null) {
    existingPrivateDialog=privateChatHelper.createPrivateChatOnRest(userId);
  }
  QBChatMessage chatMessage=ChatUtils.createNotificationMessageForFriendsRequest(context);
  privateChatHelper.sendPrivateMessage(chatMessage,userId,existingPrivateDialog.getDialogId());
}

Fixed version (ground truth):
private void sendNotificationToFriend(QBChatMessage chatMessage,int userId) throws QBResponseException {
  QBDialog existingPrivateDialog=createPrivateDialog(userId);
  privateChatHelper.sendPrivateMessage(chatMessage,userId,existingPrivateDialog.getDialogId());
}
Program: 114346
Project: 114346
Buggy source:
public void rejectFriend(int userId) throws Exception {
  roster.reject(userId);
  clearRosterEntry(userId);
  deleteUser(userId);
}

Fixed version (ground truth):
public void rejectFriend(int userId) throws Exception {
  roster.reject(userId);
  clearRosterEntry(userId);
  deleteFriend(userId);
  QBChatMessage chatMessage=ChatUtils.createNotificationMessageForRejectFriendsRequest(context);
  sendNotificationToFriend(chatMessage,userId);
}
Program: 114347
Project: 114347
Buggy source:
public void removeFriend(int userId) throws Exception {
  roster.unsubscribe(userId);
  clearRosterEntry(userId);
  deleteUser(userId);
}

Fixed version (ground truth):
public void removeFriend(int userId) throws Exception {
  roster.unsubscribe(userId);
  clearRosterEntry(userId);
  deleteFriend(userId);
  QBChatMessage chatMessage=ChatUtils.createNotificationMessageForRemoveFriendsRequest(context);
  sendNotificationToFriend(chatMessage,userId);
}
Program: 114348
Project: 114348
Buggy source:
public void inviteFriend(int userId) throws Exception {
  if (isNotInvited(userId)) {
    sendInvitation(userId);
  }
}

Fixed version (ground truth):
public void inviteFriend(int userId) throws Exception {
  if (isNotInvited(userId)) {
    sendInvitation(userId);
    QBChatMessage chatMessage=ChatUtils.createNotificationMessageForFriendsRequest(context);
    sendNotificationToFriend(chatMessage,userId);
  }
}
Program: 114349
Project: 114349
Buggy source:
public void addFriend(int userId) throws Exception {
  createFriend(userId,false);
  sendInvitation(userId);
  sendNotificationToFriend(userId);
}

Fixed version (ground truth):
public void addFriend(int userId) throws Exception {
  createFriend(userId,false);
  sendInvitation(userId);
  QBChatMessage chatMessage=ChatUtils.createNotificationMessageForFriendsRequest(context);
  sendNotificationToFriend(chatMessage,userId);
}
Program: 114350
Project: 114350
Buggy source:
private void updateFriend(int userId) throws QBResponseException {
  QBRosterEntry rosterEntry=roster.getEntry(userId);
  User user=restHelper.loadUser(userId);
  if (user == null) {
    return;
  }
  Friend friend=FriendUtils.createFriend(rosterEntry);
  Friend oldFriend=DatabaseManager.getFriendById(context,friend.getUserId());
  saveUser(user);
  saveFriend(friend);
  if (oldFriend != null) {
    checkAlertShowing(friend,oldFriend);
  }
  fillUserOnlineStatus(user);
}

Fixed version (ground truth):
private void updateFriend(int userId) throws QBResponseException {
  QBRosterEntry rosterEntry=roster.getEntry(userId);
  User user=restHelper.loadUser(userId);
  if (user == null) {
    return;
  }
  Friend friend=FriendUtils.createFriend(rosterEntry);
  saveUser(user);
  saveFriend(friend);
  fillUserOnlineStatus(user);
}
Program: 114351
Project: 114351
Buggy source:
public void acceptFriend(int userId) throws Exception {
  roster.confirmSubscription(userId);
}

Fixed version (ground truth):
public void acceptFriend(int userId) throws Exception {
  roster.confirmSubscription(userId);
  QBChatMessage chatMessage=ChatUtils.createNotificationMessageForAcceptFriendsRequest(context);
  sendNotificationToFriend(chatMessage,userId);
}
Program: 114352
Project: 114352
Buggy source:
private void friendRequestMessageReceived(QBChatMessage chatMessage){
  MessageCache messageCache=parseReceivedMessage(chatMessage);
  messageCache.setFriendsNotificationType(FriendsNotificationType.REQUEST);
  saveMessageToCache(messageCache);
}

Fixed version (ground truth):
private void friendRequestMessageReceived(QBChatMessage chatMessage,FriendsNotificationType type){
  MessageCache messageCache=parseReceivedMessage(chatMessage);
  messageCache.setFriendsNotificationType(type);
  saveMessageToCache(messageCache);
}
Program: 114353
Project: 114353
Buggy source:
@Override public void onReceivedNotification(String notificationType,QBChatMessage chatMessage){
  if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_CREATE_CHAT.equals(notificationType)) {
    createDialogByNotification(chatMessage);
  }
 else   if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_MESSAGE_DELIVERY_STATUS.equals(notificationType)) {
    messageDeliveryStatusReceived(chatMessage);
  }
 else   if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_REQUEST.equals(notificationType)) {
    friendRequestMessageReceived(chatMessage);
  }
 else {
    updateDialogByNotification(chatMessage);
  }
}

Fixed version (ground truth):
@Override public void onReceivedNotification(String notificationType,QBChatMessage chatMessage){
  if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_CREATE_CHAT.equals(notificationType)) {
    createDialogByNotification(chatMessage);
  }
 else   if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_MESSAGE_DELIVERY_STATUS.equals(notificationType)) {
    messageDeliveryStatusReceived(chatMessage);
  }
 else   if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_REQUEST.equals(notificationType)) {
    friendRequestMessageReceived(chatMessage,FriendsNotificationType.REQUEST);
  }
 else   if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_ACCEPT_REQUEST.equals(notificationType)) {
    friendRequestMessageReceived(chatMessage,FriendsNotificationType.ACCEPT);
  }
 else   if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_REJECT_REQUEST.equals(notificationType)) {
    friendRequestMessageReceived(chatMessage,FriendsNotificationType.REJECT);
  }
 else   if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_FRIENDS_REMOVE_REQUEST.equals(notificationType)) {
    friendRequestMessageReceived(chatMessage,FriendsNotificationType.REMOVE);
  }
 else {
    updateDialogByNotification(chatMessage);
  }
}
Program: 114354
Project: 114354
Buggy source:
protected void addActions(){
  addAction(QBServiceConsts.LOAD_ATTACH_FILE_SUCCESS_ACTION,loadAttachFileSuccessAction);
  addAction(QBServiceConsts.LOAD_ATTACH_FILE_FAIL_ACTION,failAction);
  addAction(QBServiceConsts.LOAD_DIALOG_MESSAGES_SUCCESS_ACTION,loadDialogMessagesSuccessAction);
  addAction(QBServiceConsts.LOAD_DIALOG_MESSAGES_FAIL_ACTION,failAction);
  updateBroadcastActionList();
}

Fixed version (ground truth):
protected void addActions(){
  addAction(QBServiceConsts.LOAD_ATTACH_FILE_SUCCESS_ACTION,loadAttachFileSuccessAction);
  addAction(QBServiceConsts.LOAD_ATTACH_FILE_FAIL_ACTION,failAction);
  addAction(QBServiceConsts.LOAD_DIALOG_MESSAGES_SUCCESS_ACTION,loadDialogMessagesSuccessAction);
  addAction(QBServiceConsts.LOAD_DIALOG_MESSAGES_FAIL_ACTION,failAction);
  addAction(QBServiceConsts.ACCEPT_FRIEND_SUCCESS_ACTION,new AcceptFriendSuccessAction());
  addAction(QBServiceConsts.ACCEPT_FRIEND_FAIL_ACTION,failAction);
  addAction(QBServiceConsts.REJECT_FRIEND_SUCCESS_ACTION,new RejectFriendSuccessAction());
  addAction(QBServiceConsts.REJECT_FRIEND_FAIL_ACTION,failAction);
  updateBroadcastActionList();
}
Program: 114355
Project: 114355
Buggy source:
@Override public void execute(Bundle bundle){
  hideActionBarProgress();
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  hideProgress();
}
Program: 114356
Project: 114356
Buggy source:
public void sendStopTypingToServer(int opponentId){
  QBPrivateChat privateChat=privateChatManager.getChat(opponentId);
  try {
    privateChat.sendStopTypingNotification();
  }
 catch (  XMPPException e) {
    ErrorUtils.logError(e);
  }
catch (  SmackException.NotConnectedException e) {
    ErrorUtils.logError(e);
  }
}

Fixed version (ground truth):
public void sendStopTypingToServer(int opponentId){
  QBPrivateChat privateChat=getPrivateChatByOpponent(opponentId);
  try {
    privateChat.sendStopTypingNotification();
  }
 catch (  XMPPException e) {
    ErrorUtils.logError(e);
  }
catch (  SmackException.NotConnectedException e) {
    ErrorUtils.logError(e);
  }
}
Program: 114357
Project: 114357
Buggy source:
public void sendIsTypingToServer(int opponentId){
  QBPrivateChat privateChat=privateChatManager.getChat(opponentId);
  try {
    privateChat.sendIsTypingNotification();
  }
 catch (  XMPPException e) {
    ErrorUtils.logError(e);
  }
catch (  SmackException.NotConnectedException e) {
    ErrorUtils.logError(e);
  }
}

Fixed version (ground truth):
public void sendIsTypingToServer(int opponentId){
  QBPrivateChat privateChat=getPrivateChatByOpponent(opponentId);
  try {
    privateChat.sendIsTypingNotification();
  }
 catch (  XMPPException e) {
    ErrorUtils.logError(e);
  }
catch (  SmackException.NotConnectedException e) {
    ErrorUtils.logError(e);
  }
}
Program: 114358
Project: 114358
Buggy source:
@Override protected void onPause(){
  super.onPause();
  onUpdateChatDialog();
  hideSmileLayout();
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  onUpdateChatDialog();
  hideSmileLayout();
  if (QBDialogType.PRIVATE.equals(dialog.getType())) {
    if (isTypingNow) {
      stopTypingMessage();
    }
  }
}
Program: 114359
Project: 114359
Buggy source:
private void checkMessageSendingPossibility(){
  messageEditText.setEnabled(DatabaseManager.isFriendInBase(PrivateDialogActivity.this,opponentFriend.getUserId()));
}

Fixed version (ground truth):
private void checkMessageSendingPossibility(){
  boolean isFriend=DatabaseManager.isFriendInBase(PrivateDialogActivity.this,opponentFriend.getUserId());
  messageEditText.setEnabled(isFriend);
}
Program: 114360
Project: 114360
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    navigateToParent();
  return true;
case R.id.action_attach:
attachButtonOnClick();
return true;
case R.id.action_audio_call:
callToUser(opponentFriend,com.quickblox.videochat.webrtc.Consts.MEDIA_STREAM.AUDIO);
return true;
case R.id.action_video_call:
callToUser(opponentFriend,com.quickblox.videochat.webrtc.Consts.MEDIA_STREAM.VIDEO);
return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  boolean isFriend=DatabaseManager.isFriendInBase(PrivateDialogActivity.this,opponentFriend.getUserId());
  if (!isFriend && item.getItemId() != android.R.id.home) {
    DialogUtils.showLong(PrivateDialogActivity.this,getResources().getString(R.string.dlg_user_is_not_friend));
    return true;
  }
switch (item.getItemId()) {
case android.R.id.home:
    navigateToParent();
  return true;
case R.id.action_attach:
attachButtonOnClick();
return true;
case R.id.action_audio_call:
callToUser(opponentFriend,com.quickblox.videochat.webrtc.Consts.MEDIA_STREAM.AUDIO);
return true;
case R.id.action_video_call:
callToUser(opponentFriend,com.quickblox.videochat.webrtc.Consts.MEDIA_STREAM.VIDEO);
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 114361
Project: 114361
Buggy source:
@Override public void onTextChanged(CharSequence charSequence,int start,int before,int count){
  super.onTextChanged(charSequence,start,before,count);
  if (TextUtils.isEmpty(charSequence) || TextUtils.isEmpty(charSequence.toString().trim())) {
    sendButton.setEnabled(false);
  }
 else {
    sendButton.setEnabled(true);
  }
  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) {
      startTypingMessage();
    }
    checkStopTyping();
  }
}
Program: 114363
Project: 114363
Buggy source:
@Override public boolean onTouch(View view,MotionEvent event){
  hideSmileLayout();
  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) {
      startTypingMessage();
    }
  }
  return false;
}
Program: 114365
Project: 114365
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(ChatUtils.PROPERTY_NOTIFICATION_TYPE) != null) {
      friendsMessageTypeCode=Integer.parseInt(historyMessage.getProperty(ChatUtils.PROPERTY_NOTIFICATION_TYPE).toString());
      if (isFriendsMessageTypeCode(friendsMessageTypeCode)) {
        messageCache.setFriendsNotificationType(FriendsNotificationType.parseByCode(friendsMessageTypeCode));
      }
    }
    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(ChatUtils.PROPERTY_NOTIFICATION_TYPE) != null) {
      friendsMessageTypeCode=Integer.parseInt(historyMessage.getProperty(ChatUtils.PROPERTY_NOTIFICATION_TYPE).toString());
      if (ChatUtils.isFriendsMessageTypeCode(friendsMessageTypeCode)) {
        messageCache.setFriendsNotificationType(FriendsNotificationType.parseByCode(friendsMessageTypeCode));
      }
    }
    saveChatMessage(context,messageCache,true);
  }
}
Program: 114366
Project: 114366
Buggy source:
public void onActivityResumed(Activity activity){
  Lo.g("String_Node_Str" + numberOfActivitiesInForeground);
  boolean activityLogeable=isActivityLogeable(activity);
  chatDestroyed=chatDestroyed && !isLoggedIn();
  if (numberOfActivitiesInForeground == 0 && chatDestroyed && activityLogeable) {
    boolean canLogin=chatDestroyed && AppSession.getSession().isSessionExist();
    if (canLogin) {
      QBLoginAndJoinDialogsCommand.start(activity);
    }
  }
  if (activityLogeable) {
    ++numberOfActivitiesInForeground;
  }
}

Fixed version (ground truth):
public void onActivityResumed(Activity activity){
  Lo.g("String_Node_Str" + numberOfActivitiesInForeground);
  boolean activityLogeable=isActivityLogeable(activity);
  chatDestroyed=chatDestroyed && !isLoggedIn();
  if (numberOfActivitiesInForeground == 0 && chatDestroyed && activityLogeable) {
    boolean canLogin=chatDestroyed && AppSession.getSession().isSessionExist();
    if (canLogin) {
      QBLoginAndJoinDialogsCommand.start(activity);
      QBLoadDialogsCommand.start(activity);
    }
  }
  if (activityLogeable) {
    ++numberOfActivitiesInForeground;
  }
}
Program: 114367
Project: 114367
Buggy source:
private void updateFriendsList(){
  friendsListView.setAdapter(friendsListAdapter);
  friendsListView.setGroupIndicator(null);
  expandAllGroups(headersCursor);
  baseActivity.hideActionBarProgress();
}

Fixed version (ground truth):
private void updateFriendsList(){
  friendsListView.setAdapter(friendsListAdapter);
  friendsListView.setGroupIndicator(null);
  expandAllGroups(headersCursor);
  if (selectedPositionList != Consts.ZERO_INT_VALUE) {
    friendsListView.setSelection(selectedPositionList);
  }
  baseActivity.hideActionBarProgress();
}
Program: 114368
Project: 114368
Buggy source:
private void registerContentObservers(){
  userTableContentObserver=new ContentObserver(new Handler()){
    @Override public void onChange(    boolean selfChange){
      checkInitFriendsList();
    }
  }
;
  friendTableContentObserver=new ContentObserver(new Handler()){
    @Override public void onChange(    boolean selfChange){
      checkInitFriendsList();
    }
  }
;
  baseActivity.getContentResolver().registerContentObserver(UserTable.CONTENT_URI,true,userTableContentObserver);
  baseActivity.getContentResolver().registerContentObserver(FriendTable.CONTENT_URI,true,friendTableContentObserver);
}

Fixed version (ground truth):
private void registerContentObservers(){
  userTableContentObserver=new ContentObserver(new Handler()){
    @Override public void onChange(    boolean selfChange){
      selectedPositionList=friendsListView.getFirstVisiblePosition();
      checkInitFriendsList();
    }
  }
;
  friendTableContentObserver=new ContentObserver(new Handler()){
    @Override public void onChange(    boolean selfChange){
      checkInitFriendsList();
    }
  }
;
  baseActivity.getContentResolver().registerContentObserver(UserTable.CONTENT_URI,true,userTableContentObserver);
  baseActivity.getContentResolver().registerContentObserver(FriendTable.CONTENT_URI,true,friendTableContentObserver);
}
Program: 114369
Project: 114369
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_profile);
  useDoubleBackPressed=false;
  user=AppSession.getSession().getUser();
  imageUtils=new ImageUtils(this);
  initUI();
  initListeners();
  initUIWithUsersData();
  initBroadcastActionList();
  initTextChangedListeners();
  updateOldUserData();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_profile);
  useDoubleBackPressed=false;
  user=AppSession.getSession().getUser();
  imageUtils=new ImageUtils(this);
  actionModeCallback=new ActionModeCallback();
  initUI();
  initListeners();
  initUIWithUsersData();
  initBroadcastActionList();
  initTextChangedListeners();
  updateOldUserData();
}
Program: 114370
Project: 114370
Buggy source:
private void startAction(){
  if (actionMode != null) {
    return;
  }
  actionMode=startActionMode(new ActionModeCallback());
}

Fixed version (ground truth):
private void startAction(){
  if (actionMode != null) {
    return;
  }
  actionMode=startActionMode(actionModeCallback);
}
Program: 114371
Project: 114371
Buggy source:
private void createFriend(int userId,boolean requestedFriend) throws QBResponseException {
  Log.d("String_Node_Str","String_Node_Str" + requestedFriend);
  User user=restHelper.loadUser(userId);
  Friend friend=FriendUtils.createFriend(userId,requestedFriend);
  fillUserOnlineStatus(user);
  saveUser(user);
  saveFriend(friend);
  Log.d("String_Node_Str","String_Node_Str" + requestedFriend + "String_Node_Str");
}

Fixed version (ground truth):
private void createFriend(int userId,boolean requestedFriend) throws QBResponseException {
  User user=restHelper.loadUser(userId);
  Friend friend=FriendUtils.createFriend(userId,requestedFriend);
  fillUserOnlineStatus(user);
  saveUser(user);
  saveFriend(friend);
}
Program: 114372
Project: 114372
Buggy source:
@Override public void subscriptionRequested(int userId){
  Log.d("String_Node_Str","String_Node_Str");
  try {
    createFriend(userId,true);
    notifyContactRequest();
  }
 catch (  QBResponseException e) {
    Log.e(TAG,SUBSCRIPTION_ERROR,e);
  }
}

Fixed version (ground truth):
@Override public void subscriptionRequested(int userId){
  try {
    createFriend(userId,true);
    notifyContactRequest();
  }
 catch (  QBResponseException e) {
    Log.e(TAG,SUBSCRIPTION_ERROR,e);
  }
}
Program: 114373
Project: 114373
Buggy source:
@Override public void entriesAdded(Collection<Integer> userIdsList){
  Log.d("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Override public void entriesAdded(Collection<Integer> userIdsList){
}
Program: 114374
Project: 114374
Buggy source:
public void init(){
  roster=QBChatService.getInstance().getRoster(QBRoster.SubscriptionMode.mutual,new SubscriptionListener());
  roster.setSubscriptionMode(QBRoster.SubscriptionMode.mutual);
  roster.addRosterListener(new RosterListener());
  restHelper=new QBRestHelper(context);
}

Fixed version (ground truth):
public void init(){
  restHelper=new QBRestHelper(context);
  roster=QBChatService.getInstance().getRoster(QBRoster.SubscriptionMode.mutual,new SubscriptionListener());
  roster.setSubscriptionMode(QBRoster.SubscriptionMode.mutual);
  roster.addRosterListener(new RosterListener());
}