nus-yam/ex-repair huggingface dataset:
Program: 114375
Project: 114375
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: 114376
Project: 114376
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: 114377
Project: 114377
Buggy source:
protected void startMainActivity(Context context,QBUser user,boolean saveRememberMe){
  AppSession.getSession().updateUser(user);
  AppSession.saveRememberMe(saveRememberMe);
  DatabaseManager.clearAllCache(context);
  MainActivity.start(context);
  KeyboardUtils.hideKeyboard(this);
  finish();
}

Fixed version (ground truth):
protected void startMainActivity(Context context,QBUser user,boolean saveRememberMe){
  AppSession.getSession().updateUser(user);
  AppSession.saveRememberMe(saveRememberMe);
  DatabaseManager.clearAllCache(context);
  MainActivity.start(context);
  finish();
}
Program: 114378
Project: 114378
Buggy source:
private void initFriendsList(){
  createHeadersCursor();
  friendsListAdapter=new FriendsListCursorAdapter(baseActivity,headersCursor,null,friendOperationAction,false);
  updateFriendsList();
}

Fixed version (ground truth):
private void initFriendsList(){
  baseActivity.showActionBarProgress();
  createHeadersCursor();
  friendsListAdapter=new FriendsListCursorAdapter(baseActivity,headersCursor,null,friendOperationAction,false);
  updateFriendsList();
}
Program: 114379
Project: 114379
Buggy source:
private void updateFriendsList(){
  friendsListView.setAdapter(friendsListAdapter);
  friendsListView.setGroupIndicator(null);
  expandAllGroups(headersCursor);
}

Fixed version (ground truth):
private void updateFriendsList(){
  friendsListView.setAdapter(friendsListAdapter);
  friendsListView.setGroupIndicator(null);
  expandAllGroups(headersCursor);
  baseActivity.hideActionBarProgress();
}
Program: 114380
Project: 114380
Buggy source:
protected void sendPrivateMessage(QBChatMessage chatMessage,int opponentId,String dialogId) throws QBResponseException {
  QBPrivateChat privateChat=privateChatManager.getChat(opponentId);
  if (privateChat == null) {
    createChatIfNotExist(opponentId);
  }
  if (!TextUtils.isEmpty(dialogId)) {
    chatMessage.setProperty(ChatUtils.PROPERTY_DIALOG_ID,dialogId);
  }
  String error=null;
  try {
    privateChat.sendMessage(chatMessage);
  }
 catch (  XMPPException e) {
    error=context.getString(R.string.dlg_fail_connection);
  }
catch (  SmackException.NotConnectedException e) {
    error=context.getString(R.string.dlg_fail_connection);
  }
  if (error != null) {
    throw new QBResponseException(error);
  }
}

Fixed version (ground truth):
protected void sendPrivateMessage(QBChatMessage chatMessage,int opponentId,String dialogId) throws QBResponseException {
  QBPrivateChat privateChat=privateChatManager.getChat(opponentId);
  if (privateChat == null) {
    privateChat=createChatIfNotExist(opponentId);
  }
  if (!TextUtils.isEmpty(dialogId)) {
    chatMessage.setProperty(ChatUtils.PROPERTY_DIALOG_ID,dialogId);
  }
  String error=null;
  try {
    privateChat.sendMessage(chatMessage);
  }
 catch (  XMPPException e) {
    error=context.getString(R.string.dlg_fail_connection);
  }
catch (  SmackException.NotConnectedException e) {
    error=context.getString(R.string.dlg_fail_connection);
  }
  if (error != null) {
    throw new QBResponseException(error);
  }
}
Program: 114381
Project: 114381
Buggy source:
private void loadAvatar(){
  String url=userCustomData.getAvatar_url();
  if (!TextUtils.isEmpty(url)) {
    ImageLoader.getInstance().displayImage(url,avatarImageView,Consts.UIL_USER_AVATAR_DISPLAY_OPTIONS);
  }
}

Fixed version (ground truth):
private void loadAvatar(){
  if (userCustomData != null && !TextUtils.isEmpty(userCustomData.getAvatar_url())) {
    ImageLoader.getInstance().displayImage(userCustomData.getAvatar_url(),avatarImageView,Consts.UIL_USER_AVATAR_DISPLAY_OPTIONS);
  }
}
Program: 114382
Project: 114382
Buggy source:
public synchronized void login(QBUser user) throws XMPPException, IOException, SmackException, QBResponseException {
  if (!QBChatService.isInitialized()) {
    QBChatService.init(context);
    QBChatService.setDefaultPacketReplyTimeout(Consts.DEFAULT_PACKET_REPLY_TIMEOUT);
    chatService=QBChatService.getInstance();
    chatService.addConnectionListener(connectionListener);
  }
  if (!chatService.isLoggedIn() && user != null) {
    chatService.login(user);
    chatService.startAutoSendPresence(AUTO_PRESENCE_INTERVAL_IN_SECONDS);
  }
}

Fixed version (ground truth):
public synchronized void login(QBUser user) throws XMPPException, IOException, SmackException, QBResponseException {
  if (!chatService.isLoggedIn() && user != null) {
    chatService.login(user);
    chatService.startAutoSendPresence(AUTO_PRESENCE_INTERVAL_IN_SECONDS);
  }
}
Program: 114383
Project: 114383
Buggy source:
public void init(){
  roster=QBChatService.getInstance().getRoster();
  roster.setSubscriptionMode(QBRoster.SubscriptionMode.mutual);
  roster.addRosterListener(new RosterListener());
  roster.addSubscriptionListener(new SubscriptionListener());
}

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

Fixed version (ground truth):
private void updateFriend(int userId) throws QBResponseException {
  QBRosterEntry rosterEntry=roster.getEntry(userId);
  User user=loadUser(userId);
  if (user == null) {
    return;
  }
  Friend friend=FriendUtils.createFriend(rosterEntry);
  fillUserOnlineStatus(user);
  saveUser(user);
  saveFriend(friend);
  checkAlertShowing(friend);
}
Program: 114385
Project: 114385
Buggy source:
public void leaveDialogs() throws XMPPException, SmackException.NotConnectedException {
  for (  QBDialog dialog : dialogsList) {
    if (!QBDialogType.PRIVATE.equals(dialog.getType())) {
      QBRoomChat roomChat=roomChatManager.getRoom(dialog.getRoomJid());
      if (roomChat != null && roomChat.isJoined()) {
        roomChat.leave();
      }
    }
  }
}

Fixed version (ground truth):
public void leaveDialogs() throws XMPPException, SmackException.NotConnectedException {
  if (dialogsList != null) {
    for (    QBDialog dialog : dialogsList) {
      if (!QBDialogType.PRIVATE.equals(dialog.getType())) {
        QBRoomChat roomChat=roomChatManager.getRoom(dialog.getRoomJid());
        if (roomChat != null && roomChat.isJoined()) {
          roomChat.leave();
        }
      }
    }
  }
}
Program: 114386
Project: 114386
Buggy source:
private void addLoginChatAndInitCommands(CompositeServiceCommand loginCommand){
  QBPrivateChatHelper chatHelper=(QBPrivateChatHelper)getHelper(PRIVATE_CHAT_HELPER);
  QBMultiChatHelper multiChatHelper=(QBMultiChatHelper)getHelper(MULTI_CHAT_HELPER);
  QBInitChatCommand initChatCommand=new QBInitChatCommand(this,chatHelper,multiChatHelper,QBServiceConsts.INIT_CHAT_SUCCESS_ACTION,QBServiceConsts.INIT_CHAT_FAIL_ACTION);
  QBChatRestHelper chatRestHelper=(QBChatRestHelper)getHelper(CHAT_REST_HELPER);
  QBLoginChatCommand loginChatCommand=new QBLoginChatCommand(this,authHelper,chatRestHelper,QBServiceConsts.LOGIN_CHAT_SUCCESS_ACTION,QBServiceConsts.LOGIN_CHAT_FAIL_ACTION);
  QBInitVideoChatCommand initVideoChatCommand=new QBInitVideoChatCommand(this,videoChatHelper,QBServiceConsts.INIT_VIDEO_CHAT_SUCCESS_ACTION,QBServiceConsts.INIT_VIDEO_CHAT_FAIL_ACTION);
  QBInitFriendListCommand initFriendListCommand=new QBInitFriendListCommand(this,friendListHelper,QBServiceConsts.INIT_FRIEND_LIST_SUCCESS_ACTION,QBServiceConsts.INIT_FRIEND_LIST_FAIL_ACTION);
  loginCommand.addCommand(loginChatCommand);
  loginCommand.addCommand(initChatCommand);
  loginCommand.addCommand(initVideoChatCommand);
  loginCommand.addCommand(initFriendListCommand);
}

Fixed version (ground truth):
private void addLoginChatAndInitCommands(CompositeServiceCommand loginCommand){
  QBChatRestHelper chatRestHelper=(QBChatRestHelper)getHelper(CHAT_REST_HELPER);
  QBPrivateChatHelper chatHelper=(QBPrivateChatHelper)getHelper(PRIVATE_CHAT_HELPER);
  QBMultiChatHelper multiChatHelper=(QBMultiChatHelper)getHelper(MULTI_CHAT_HELPER);
  QBInitChatServiceCommand initChatServiceCommand=new QBInitChatServiceCommand(this,chatRestHelper,QBServiceConsts.INIT_CHAT_SERVICE_SUCCESS_ACTION,QBServiceConsts.INIT_CHAT_SERVICE_FAIL_ACTION);
  QBLoginChatCommand loginChatCommand=new QBLoginChatCommand(this,authHelper,chatRestHelper,QBServiceConsts.LOGIN_CHAT_SUCCESS_ACTION,QBServiceConsts.LOGIN_CHAT_FAIL_ACTION);
  QBInitFriendListCommand initFriendListCommand=new QBInitFriendListCommand(this,friendListHelper,QBServiceConsts.INIT_FRIEND_LIST_SUCCESS_ACTION,QBServiceConsts.INIT_FRIEND_LIST_FAIL_ACTION);
  QBInitChatsCommand initChatsCommand=new QBInitChatsCommand(this,chatHelper,multiChatHelper,QBServiceConsts.INIT_CHATS_SUCCESS_ACTION,QBServiceConsts.INIT_CHATS_FAIL_ACTION);
  QBInitVideoChatCommand initVideoChatCommand=new QBInitVideoChatCommand(this,videoChatHelper,QBServiceConsts.INIT_VIDEO_CHAT_SUCCESS_ACTION,QBServiceConsts.INIT_VIDEO_CHAT_FAIL_ACTION);
  loginCommand.addCommand(initChatServiceCommand);
  loginCommand.addCommand(loginChatCommand);
  loginCommand.addCommand(initFriendListCommand);
  loginCommand.addCommand(initChatsCommand);
  loginCommand.addCommand(initVideoChatCommand);
}
Program: 114387
Project: 114387
Buggy source:
@Override public void execute(Bundle bundle){
  ArrayList<ParcelableQBDialog> parcelableDialogsList=bundle.getParcelableArrayList(QBServiceConsts.EXTRA_CHATS_DIALOGS);
  if (parcelableDialogsList.isEmpty()) {
    emptyListTextView.setVisibility(View.VISIBLE);
  }
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  ArrayList<ParcelableQBDialog> parcelableDialogsList=bundle.getParcelableArrayList(QBServiceConsts.EXTRA_CHATS_DIALOGS);
  if (parcelableDialogsList == null) {
    emptyListTextView.setVisibility(View.VISIBLE);
  }
}
Program: 114388
Project: 114388
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());
  }
  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);
  updateDialog(context,messageCache.getDialogId(),messageCache.getMessage(),messageCache.getTime(),messageCache.getSenderId());
}

Fixed version (ground truth):
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());
  }
  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: 114389
Project: 114389
Buggy source:
public static void saveChatMessages(Context context,List<QBChatHistoryMessage> messagesList,String dialogId){
  for (  QBChatHistoryMessage historyMessage : messagesList) {
    String messageId=historyMessage.getId();
    String message=historyMessage.getBody();
    int senderId=historyMessage.getSenderId();
    long time=historyMessage.getDateSent();
    String attachURL;
    attachURL=ChatUtils.getAttachUrlFromMessage(historyMessage.getAttachments());
    MessageCache messageCache=new MessageCache(messageId,dialogId,null,senderId,message,attachURL,time,true,true);
    saveChatMessage(context,messageCache);
  }
}

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;
    attachURL=ChatUtils.getAttachUrlFromMessage(historyMessage.getAttachments());
    messageCache=new MessageCache(messageId,dialogId,null,senderId,message,attachURL,time,true,true);
    saveChatMessage(context,messageCache);
  }
  if (messageCache != null) {
    updateDialog(context,messageCache.getDialogId(),messageCache.getMessage(),messageCache.getTime(),messageCache.getSenderId(),Consts.ZERO_INT_VALUE);
  }
}
Program: 114390
Project: 114390
Buggy source:
public static void updateDialog(Context context,String dialogId,String lastMessage,long dateSent,long lastSenderId){
  ContentResolver resolver=context.getContentResolver();
  ContentValues values=new ContentValues();
  values.put(DialogTable.Cols.COUNT_UNREAD_MESSAGES,getCountUnreadMessagesByRoomJid(context,dialogId));
  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=new ContentValues();
  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);
}
Program: 114391
Project: 114391
Buggy source:
public static void updateStatusMessage(Context context,String messageId,boolean isRead){
  ContentValues values=new ContentValues();
  String condition=MessageTable.Cols.ID + "String_Node_Str" + messageId+ "String_Node_Str";
  ContentResolver resolver=context.getContentResolver();
  Cursor cursor=resolver.query(MessageTable.CONTENT_URI,null,condition,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    String roomJidId=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));
    long lastSenderId=cursor.getLong(cursor.getColumnIndex(MessageTable.Cols.SENDER_ID));
    values.put(MessageTable.Cols.IS_READ,isRead);
    resolver.update(MessageTable.CONTENT_URI,values,condition,null);
    cursor.close();
    updateDialog(context,roomJidId,message,time,lastSenderId);
  }
}

Fixed version (ground truth):
public static void updateStatusMessage(Context context,String messageId,boolean isRead){
  ContentValues values=new ContentValues();
  String condition=MessageTable.Cols.ID + "String_Node_Str" + messageId+ "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));
    long lastSenderId=cursor.getLong(cursor.getColumnIndex(MessageTable.Cols.SENDER_ID));
    values.put(MessageTable.Cols.IS_READ,isRead);
    resolver.update(MessageTable.CONTENT_URI,values,condition,null);
    cursor.close();
    int countUnreadMessagesLocal=getCountUnreadMessagesByDialogIdLocal(context,dialogId);
    countUnreadMessagesLocal=--countUnreadMessagesLocal;
    updateDialog(context,dialogId,message,time,lastSenderId,countUnreadMessagesLocal);
  }
}
Program: 114392
Project: 114392
Buggy source:
public void updateDialog(QBDialog dialog){
  DatabaseManager.updateDialog(context,dialog.getDialogId(),dialog.getLastMessage(),dialog.getLastMessageDateSent(),dialog.getLastMessageUserId());
}

Fixed version (ground truth):
public void updateDialog(QBDialog dialog){
  int countUnreadDialog=DatabaseManager.getCountUnreadMessagesByDialogIdLocal(context,dialog.getDialogId());
  DatabaseManager.updateDialog(context,dialog.getDialogId(),dialog.getLastMessage(),dialog.getLastMessageDateSent(),dialog.getLastMessageUserId(),countUnreadDialog);
}
Program: 114393
Project: 114393
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  rootView=getLayoutInflater().inflate(layoutResID,null);
  setContentView(rootView);
  imageUtils=new ImageUtils(this);
  loadAttachFileSuccessAction=new LoadAttachFileSuccessAction();
  loadDialogMessagesSuccessAction=new LoadDialogMessagesSuccessAction();
  initUI();
  initListeners();
  initActionBar();
  addActions();
  isNeedToScrollMessages=true;
  hideSmileLayout();
  registerContentObservers();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  rootView=getLayoutInflater().inflate(layoutResID,null);
  setContentView(rootView);
  imageUtils=new ImageUtils(this);
  loadAttachFileSuccessAction=new LoadAttachFileSuccessAction();
  loadDialogMessagesSuccessAction=new LoadDialogMessagesSuccessAction();
  initUI();
  initListeners();
  initActionBar();
  addActions();
  isNeedToScrollMessages=true;
  hideSmileLayout();
}
Program: 114394
Project: 114394
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
  if (chatHelper != null) {
    chatHelper.closeChat(dialog,generateBundleToInitDialog());
  }
  unregisterContentObservers();
  removeActions();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
  if (chatHelper != null) {
    chatHelper.closeChat(dialog,generateBundleToInitDialog());
  }
  removeActions();
}
Program: 114395
Project: 114395
Buggy source:
private void createFriendTable(SQLiteDatabase db){
  StringBuilder friendTableFields=new StringBuilder();
  friendTableFields.append(FriendTable.Cols.ID).append("String_Node_Str").append(FriendTable.Cols.USER_ID).append("String_Node_Str").append(FriendTable.Cols.RELATION_STATUS_ID).append("String_Node_Str").append(FriendTable.Cols.USER_ID).append("String_Node_Str").append(UserTable.TABLE_NAME).append("String_Node_Str").append(UserTable.Cols.USER_ID).append("String_Node_Str").append(FriendTable.Cols.RELATION_STATUS_ID).append("String_Node_Str").append(FriendsRelationTable.TABLE_NAME).append("String_Node_Str").append(FriendsRelationTable.Cols.RELATION_STATUS_ID).append("String_Node_Str");
  createTable(db,FriendTable.TABLE_NAME,friendTableFields.toString());
}

Fixed version (ground truth):
private void createFriendTable(SQLiteDatabase db){
  StringBuilder friendTableFields=new StringBuilder();
  friendTableFields.append(FriendTable.Cols.ID).append("String_Node_Str").append(FriendTable.Cols.USER_ID).append("String_Node_Str").append(FriendTable.Cols.TEMP_RELATION_STATUS_ID).append("String_Node_Str").append(FriendTable.Cols.RELATION_STATUS_ID).append("String_Node_Str").append(FriendTable.Cols.USER_ID).append("String_Node_Str").append(UserTable.TABLE_NAME).append("String_Node_Str").append(UserTable.Cols.USER_ID).append("String_Node_Str").append(FriendTable.Cols.RELATION_STATUS_ID).append("String_Node_Str").append(FriendsRelationTable.TABLE_NAME).append("String_Node_Str").append(FriendsRelationTable.Cols.RELATION_STATUS_ID).append("String_Node_Str");
  createTable(db,FriendTable.TABLE_NAME,friendTableFields.toString());
}
Program: 114396
Project: 114396
Buggy source:
public static boolean isFriendInBase(Context context,int searchId){
  int relationStatusFromId=DatabaseManager.getRelationStatusIdByName(context,QBFriendListHelper.RELATION_STATUS_FROM);
  int relationStatusBothId=DatabaseManager.getRelationStatusIdByName(context,QBFriendListHelper.RELATION_STATUS_BOTH);
  String condition=FriendTable.TABLE_NAME + "String_Node_Str" + FriendTable.Cols.RELATION_STATUS_ID+ "String_Node_Str"+ relationStatusFromId+ "String_Node_Str"+ FriendTable.TABLE_NAME+ "String_Node_Str"+ FriendTable.Cols.RELATION_STATUS_ID+ "String_Node_Str"+ relationStatusBothId+ "String_Node_Str"+ FriendTable.TABLE_NAME+ "String_Node_Str"+ FriendTable.Cols.USER_ID+ "String_Node_Str"+ searchId;
  ContentResolver resolver=context.getContentResolver();
  Cursor cursor=resolver.query(UserTable.USER_FRIEND_CONTENT_URI,null,USER_FRIEND_RELATION_KEY + "String_Node_Str" + condition+ "String_Node_Str",null,null);
  boolean isFriendInBase=cursor.getCount() > Consts.ZERO_INT_VALUE;
  cursor.close();
  return isFriendInBase;
}

Fixed version (ground truth):
public static boolean isFriendInBase(Context context,int searchId){
  int relationStatusFromId=DatabaseManager.getRelationStatusIdByName(context,QBFriendListHelper.RELATION_STATUS_FROM);
  int relationStatusToId=DatabaseManager.getRelationStatusIdByName(context,QBFriendListHelper.RELATION_STATUS_TO);
  int relationStatusBothId=DatabaseManager.getRelationStatusIdByName(context,QBFriendListHelper.RELATION_STATUS_BOTH);
  String condition=FriendTable.TABLE_NAME + "String_Node_Str" + FriendTable.Cols.RELATION_STATUS_ID+ "String_Node_Str"+ relationStatusFromId+ "String_Node_Str"+ FriendTable.TABLE_NAME+ "String_Node_Str"+ FriendTable.Cols.RELATION_STATUS_ID+ "String_Node_Str"+ relationStatusBothId+ "String_Node_Str"+ FriendTable.TABLE_NAME+ "String_Node_Str"+ FriendTable.Cols.RELATION_STATUS_ID+ "String_Node_Str"+ relationStatusToId+ "String_Node_Str"+ FriendTable.TABLE_NAME+ "String_Node_Str"+ FriendTable.Cols.USER_ID+ "String_Node_Str"+ searchId;
  ContentResolver resolver=context.getContentResolver();
  Cursor cursor=resolver.query(UserTable.USER_FRIEND_CONTENT_URI,null,USER_FRIEND_RELATION_KEY + "String_Node_Str" + condition+ "String_Node_Str",null,null);
  boolean isFriendInBase=cursor.getCount() > Consts.ZERO_INT_VALUE;
  cursor.close();
  return isFriendInBase;
}
Program: 114397
Project: 114397
Buggy source:
private static ContentValues getContentValuesFriendTable(Friend friend){
  ContentValues values=new ContentValues();
  values.put(FriendTable.Cols.USER_ID,friend.getUserId());
  values.put(FriendTable.Cols.RELATION_STATUS_ID,friend.getRelationStatusId());
  return values;
}

Fixed version (ground truth):
private static ContentValues getContentValuesFriendTable(Friend friend){
  ContentValues values=new ContentValues();
  values.put(FriendTable.Cols.USER_ID,friend.getUserId());
  values.put(FriendTable.Cols.RELATION_STATUS_ID,friend.getRelationStatusId());
  values.put(FriendTable.Cols.TEMP_RELATION_STATUS_ID,friend.getTempRelationStatusId());
  return values;
}
Program: 114398
Project: 114398
Buggy source:
public static void savePeople(Context context,List<User> usersList,List<Friend> friendsList){
  for (  User user : usersList) {
    saveUser(context,user);
  }
  for (  Friend friend : friendsList) {
    saveFriend(context,friend);
  }
}

Fixed version (ground truth):
public static void savePeople(Context context,List<User> usersList,List<Friend> friendsList){
  for (  User user : usersList) {
    saveUser(context,user);
  }
  for (  Friend friend : friendsList) {
    if (!DatabaseManager.hasFriendTempStatus(context,friend.getUserId())) {
      saveFriend(context,friend);
    }
  }
}
Program: 114399
Project: 114399
Buggy source:
public static void deleteUserById(Context context,int userId){
  context.getContentResolver().delete(FriendTable.CONTENT_URI,FriendTable.Cols.USER_ID + "String_Node_Str" + userId,null);
}

Fixed version (ground truth):
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;
}
Program: 114400
Project: 114400
Buggy source:
public Friend(Integer userId,String relationStatus){
  this.userId=userId;
  this.relationStatus=relationStatus;
}

Fixed version (ground truth):
public Friend(Integer userId,String relationStatus,int tempRelationStatusId){
  this.userId=userId;
  this.relationStatus=relationStatus;
  this.tempRelationStatusId=tempRelationStatusId;
}
Program: 114401
Project: 114401
Buggy source:
@Override protected Bundle perform(Bundle extras) throws Exception {
  int userId=extras.getInt(QBServiceConsts.EXTRA_USER_ID);
  friendListHelper.inviteFriend(userId);
  Bundle result=new Bundle();
  result.putSerializable(QBServiceConsts.EXTRA_FRIEND_ID,userId);
  return result;
}

Fixed version (ground truth):
@Override protected Bundle perform(Bundle extras) throws Exception {
  int userId=extras.getInt(QBServiceConsts.EXTRA_USER_ID);
  friendListHelper.addFriend(userId);
  Bundle result=new Bundle();
  result.putSerializable(QBServiceConsts.EXTRA_FRIEND_ID,userId);
  return result;
}
Program: 114402
Project: 114402
Buggy source:
public QBRemoveFriendCommand(Context context,String successAction,String failAction){
  super(context,successAction,failAction);
}

Fixed version (ground truth):
public QBRemoveFriendCommand(Context context,QBFriendListHelper friendListHelper,String successAction,String failAction){
  super(context,successAction,failAction);
  this.friendListHelper=friendListHelper;
}
Program: 114403
Project: 114403
Buggy source:
public static void start(Context context,User friend){
  Intent intent=new Intent(QBServiceConsts.REMOVE_FRIEND_ACTION,null,context,QBService.class);
  intent.putExtra(QBServiceConsts.EXTRA_FRIEND,friend);
  context.startService(intent);
}

Fixed version (ground truth):
public static void start(Context context,int friendId){
  Intent intent=new Intent(QBServiceConsts.REMOVE_FRIEND_ACTION,null,context,QBService.class);
  intent.putExtra(QBServiceConsts.EXTRA_FRIEND_ID,friendId);
  context.startService(intent);
}
Program: 114404
Project: 114404
Buggy source:
@Override protected Bundle perform(Bundle extras) throws Exception {
  User friend=(User)extras.getSerializable(QBServiceConsts.EXTRA_FRIEND);
  QBCustomObjectRequestBuilder builder=new QBCustomObjectRequestBuilder();
  builder.eq(Consts.FRIEND_FIELD_USER_ID,AppSession.getSession().getUser().getId());
  builder.eq(Consts.FRIEND_FIELD_FRIEND_ID,friend.getUserId());
  List<QBCustomObject> objects=QBCustomObjects.getObjects(Consts.EXTRA_FRIEND,builder,(Bundle)null);
  QBCustomObjects.deleteObject(Consts.EXTRA_FRIEND,objects.get(0).getCustomObjectId());
  return null;
}

Fixed version (ground truth):
@Override protected Bundle perform(Bundle extras) throws Exception {
  int friendId=extras.getInt(QBServiceConsts.EXTRA_FRIEND_ID);
  friendListHelper.removeFriend(friendId);
  Bundle result=new Bundle();
  result.putSerializable(QBServiceConsts.EXTRA_FRIEND_ID,friendId);
  return result;
}
Program: 114405
Project: 114405
Buggy source:
public static void savePeople(Context context,List<User> usersList,List<Friend> friendsList){
  for (  User user : usersList) {
    saveUser(context,user);
  }
  for (  Friend friend : friendsList) {
    saveFriend(context,friend);
  }
}

Fixed version (ground truth):
public static void savePeople(Context context,List<User> usersList,List<Friend> friendsList){
  for (  User user : usersList) {
    saveUser(context,user);
  }
  for (  Friend friend : friendsList) {
    if (!isUserRequested(context,friend.getUserId())) {
      saveFriend(context,friend);
    }
  }
}
Program: 114406
Project: 114406
Buggy source:
public void removeFriend(int userId) throws Exception {
  roster.unsubscribe(userId);
  QBRosterEntry rosterEntry=roster.getEntry(userId);
  if (rosterEntry != null) {
    roster.removeEntry(rosterEntry);
  }
 else {
    deleteUser(userId);
  }
}

Fixed version (ground truth):
public void removeFriend(int userId) throws Exception {
  roster.unsubscribe(userId);
  QBRosterEntry rosterEntry=roster.getEntry(userId);
  if (rosterEntry != null && roster.contains(userId)) {
    roster.removeEntry(rosterEntry);
  }
 else {
    deleteUser(userId);
  }
}
Program: 114407
Project: 114407
Buggy source:
public void addFriend(int userId) throws Exception {
  if (isNotInvited(userId)) {
    sendInvitation(userId);
  }
}

Fixed version (ground truth):
public void addFriend(int userId) throws Exception {
  if (isNotInvited(userId)) {
    Friend friend=new Friend(userId);
    friend.setRequestedFriend(false);
    saveFriend(friend);
    sendInvitation(userId);
  }
}
Program: 114408
Project: 114408
Buggy source:
public static Cursor getAllFriends(Context context){
  String sortOrder=UserTable.Cols.ID + "String_Node_Str" + UserTable.Cols.FULL_NAME+ "String_Node_Str";
  ContentResolver resolver=context.getContentResolver();
  Cursor cursor=resolver.query(UserTable.USER_FRIEND_CONTENT_URI,null,USER_FRIEND_RELATION_KEY,null,sortOrder);
  return cursor;
}

Fixed version (ground truth):
public static Cursor getAllFriends(Context context,int relationStatusId){
  String condition=FriendTable.TABLE_NAME + "String_Node_Str" + FriendTable.Cols.RELATION_STATUS_ID+ "String_Node_Str"+ relationStatusId;
  String sortOrder=UserTable.Cols.ID + "String_Node_Str" + UserTable.Cols.FULL_NAME+ "String_Node_Str";
  ContentResolver resolver=context.getContentResolver();
  Cursor cursor=resolver.query(UserTable.USER_FRIEND_CONTENT_URI,null,USER_FRIEND_RELATION_KEY + "String_Node_Str" + condition,null,sortOrder);
  return cursor;
}
Program: 114409
Project: 114409
Buggy source:
public static void saveFriend(Context context,Friend friend){
  ContentValues values=getContentValuesFriendTable(context,friend);
  String condition=FriendTable.Cols.USER_ID + "String_Node_Str" + friend.getUserId()+ "String_Node_Str";
  ContentResolver resolver=context.getContentResolver();
  Cursor cursor=resolver.query(FriendTable.CONTENT_URI,null,condition,null,null);
  if (cursor != null && cursor.getCount() > Consts.ZERO_INT_VALUE) {
    resolver.update(FriendTable.CONTENT_URI,values,condition,null);
  }
 else {
    resolver.insert(FriendTable.CONTENT_URI,values);
  }
  if (cursor != null) {
    cursor.close();
  }
}

Fixed version (ground truth):
public static void saveFriend(Context context,Friend friend){
  initFriendsRelationStatuses(context);
  int relationStatusId=getRelationStatusIdByName(context,friend.getRelationStatus());
  friend.setRelationStatusId(relationStatusId);
  ContentValues values=getContentValuesFriendTable(friend);
  String condition=FriendTable.Cols.USER_ID + "String_Node_Str" + friend.getUserId()+ "String_Node_Str";
  ContentResolver resolver=context.getContentResolver();
  Cursor cursor=resolver.query(FriendTable.CONTENT_URI,null,condition,null,null);
  if (cursor != null && cursor.getCount() > Consts.ZERO_INT_VALUE) {
    resolver.update(FriendTable.CONTENT_URI,values,condition,null);
  }
 else {
    resolver.insert(FriendTable.CONTENT_URI,values);
  }
  if (cursor != null) {
    cursor.close();
  }
}
Program: 114410
Project: 114410
Buggy source:
private static ContentValues getContentValuesFriendTable(Context context,Friend friend){
  ContentValues values=new ContentValues();
  int relationStatusId=getRelationStatusId(context,friend.getRelationStatus());
  if (relationStatusId == Consts.ZERO_INT_VALUE) {
    relationStatusId=saveFriendsRelationStatus(context,friend.getRelationStatus());
  }
  values.put(FriendTable.Cols.USER_ID,friend.getUserId());
  values.put(FriendTable.Cols.RELATION_STATUS_ID,relationStatusId);
  return values;
}

Fixed version (ground truth):
private static ContentValues getContentValuesFriendTable(Friend friend){
  ContentValues values=new ContentValues();
  values.put(FriendTable.Cols.USER_ID,friend.getUserId());
  values.put(FriendTable.Cols.RELATION_STATUS_ID,friend.getRelationStatusId());
  return values;
}
Program: 114411
Project: 114411
Buggy source:
public List<Integer> updateFriendList() throws QBResponseException {
  Collection<QBRosterEntry> rosterEntryCollection;
  List<Integer> userIdsList=new ArrayList<Integer>();
  if (roster != null) {
    rosterEntryCollection=roster.getEntries();
    if (!rosterEntryCollection.isEmpty()) {
      userIdsList=FriendUtils.getUserIdsFromRoster(rosterEntryCollection);
      updateFriends(userIdsList,rosterEntryCollection);
    }
    try {
      makeAutoSubscription(rosterEntryCollection);
    }
 catch (    QBResponseException e) {
      ErrorUtils.logError(e);
    }
  }
 else {
    ErrorUtils.showError(context,"String_Node_Str");
  }
  return userIdsList;
}

Fixed version (ground truth):
public List<Integer> updateFriendList() throws QBResponseException {
  Collection<QBRosterEntry> rosterEntryCollection;
  List<Integer> userIdsList=new ArrayList<Integer>();
  if (roster != null) {
    rosterEntryCollection=roster.getEntries();
    if (!rosterEntryCollection.isEmpty()) {
      userIdsList=FriendUtils.getUserIdsFromRoster(rosterEntryCollection);
      updateFriends(userIdsList,rosterEntryCollection);
    }
  }
 else {
    ErrorUtils.logError(TAG,ROSTER_INIT_ERROR);
  }
  return userIdsList;
}
Program: 114412
Project: 114412
Buggy source:
@Override public void entriesUpdated(Collection<Integer> userIdsList){
  try {
    updateFriends(userIdsList);
  }
 catch (  QBResponseException e) {
    Log.e(TAG,"String_Node_Str",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: 114413
Project: 114413
Buggy source:
@Override public void presenceChanged(QBPresence presence){
  User user=DatabaseManager.getUserById(context,presence.getUserId());
  if (user == null) {
    ErrorUtils.logError(TAG,"String_Node_Str" + presence.getUserId());
  }
 else {
    fillUserOnlineStatus(user,presence);
    DatabaseManager.saveUser(context,user);
  }
}

Fixed version (ground truth):
@Override public void presenceChanged(QBPresence presence){
  User user=DatabaseManager.getUserById(context,presence.getUserId());
  if (user == null) {
    ErrorUtils.logError(TAG,PRESENCE_CHANGE_ERROR + presence.getUserId());
  }
 else {
    fillUserOnlineStatus(user,presence);
    DatabaseManager.saveUser(context,user);
  }
}
Program: 114414
Project: 114414
Buggy source:
private void makeAutoSubscription(Collection<QBRosterEntry> entries) throws QBResponseException {
  for (  QBRosterEntry entry : entries) {
    if (RosterPacket.ItemType.from.equals(entry.getType())) {
      boolean errorOccurred=false;
      try {
        roster.confirmSubscription(entry.getUserId());
      }
 catch (      SmackException.NotConnectedException e) {
        errorOccurred=true;
      }
catch (      SmackException.NotLoggedInException e) {
        errorOccurred=true;
      }
catch (      XMPPException e) {
        errorOccurred=true;
      }
catch (      SmackException.NoResponseException e) {
        errorOccurred=true;
      }
      if (errorOccurred) {
        throw new QBResponseException("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private void makeAutoSubscription(Collection<QBRosterEntry> entriesList) throws QBResponseException {
  for (  QBRosterEntry rosterEntry : entriesList) {
    if (RosterPacket.ItemType.from.equals(rosterEntry.getType())) {
      boolean errorOccurred=false;
      try {
        roster.confirmSubscription(rosterEntry.getUserId());
      }
 catch (      SmackException.NotConnectedException e) {
        errorOccurred=true;
      }
catch (      SmackException.NotLoggedInException e) {
        errorOccurred=true;
      }
catch (      XMPPException e) {
        errorOccurred=true;
      }
catch (      SmackException.NoResponseException e) {
        errorOccurred=true;
      }
      if (errorOccurred) {
        throw new QBResponseException("String_Node_Str");
      }
    }
  }
}
Program: 114415
Project: 114415
Buggy source:
private void addUserToFriendList(int userId) throws Exception {
  User user=loadUser(userId);
  Friend friend=FriendUtils.createNewFriend(user);
  fillUserOnlineStatus(user);
  DatabaseManager.saveUser(context,user);
  DatabaseManager.saveFriend(context,friend);
}

Fixed version (ground truth):
private void addUserToFriendList(int userId) throws Exception {
  User user=loadUser(userId);
  Friend friend=FriendUtils.getFriendWithStatus(user.getUserId(),RosterPacket.ItemType.to.name());
  fillUserOnlineStatus(user);
  DatabaseManager.saveUser(context,user);
  DatabaseManager.saveFriend(context,friend);
}
Program: 114416
Project: 114416
Buggy source:
@Override public void subscriptionRequested(int userId){
  try {
    roster.confirmSubscription(userId);
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

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

Fixed version (ground truth):
@Override public void entriesAdded(Collection<Integer> userIdsList){
  try {
    updateFriends(userIdsList);
  }
 catch (  QBResponseException e) {
    Log.e(TAG,ENTRIES_ADDED_ERROR,e);
  }
}
Program: 114418
Project: 114418
Buggy source:
private void initImageLoader(Context context){
  ImageLoader.getInstance().init(ImageHelper.getImageLoaderConfiguration(context));
}

Fixed version (ground truth):
private void initImageLoader(Context context){
  ImageLoader.getInstance().init(ImageUtils.getImageLoaderConfiguration(context));
}
Program: 114419
Project: 114419
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_signup);
  resources=getResources();
  initUI();
  initListeners();
  useDoubleBackPressed=true;
  user=new QBUser();
  imageHelper=new ImageHelper(this);
  validationUtils=new ValidationUtils(SignUpActivity.this,new EditText[]{fullnameEditText,emailEditText,passwordEditText},new String[]{resources.getString(R.string.dlg_not_fullname_field_entered),resources.getString(R.string.dlg_not_email_field_entered),resources.getString(R.string.dlg_not_password_field_entered)});
  addActions();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_signup);
  resources=getResources();
  initUI();
  initListeners();
  useDoubleBackPressed=true;
  user=new QBUser();
  imageUtils=new ImageUtils(this);
  validationUtils=new ValidationUtils(SignUpActivity.this,new EditText[]{fullnameEditText,emailEditText,passwordEditText},new String[]{resources.getString(R.string.dlg_not_fullname_field_entered),resources.getString(R.string.dlg_not_email_field_entered),resources.getString(R.string.dlg_not_password_field_entered)});
  addActions();
}
Program: 114420
Project: 114420
Buggy source:
public void signUpOnClickListener(View view){
  String fullNameText=fullnameEditText.getText().toString();
  String emailText=emailEditText.getText().toString();
  String passwordText=passwordEditText.getText().toString();
  if (validationUtils.isValidUserDate(fullNameText,emailText,passwordText)) {
    user.setFullName(fullNameText);
    user.setEmail(emailText);
    user.setPassword(passwordText);
    showProgress();
    if (isNeedUpdateAvatar) {
      new ReceiveImageFileTask(this).execute(imageHelper,avatarBitmapCurrent,true);
    }
 else {
      App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,false);
      QBSignUpCommand.start(SignUpActivity.this,user,null);
    }
  }
}

Fixed version (ground truth):
public void signUpOnClickListener(View view){
  String fullNameText=fullnameEditText.getText().toString();
  String emailText=emailEditText.getText().toString();
  String passwordText=passwordEditText.getText().toString();
  if (validationUtils.isValidUserDate(fullNameText,emailText,passwordText)) {
    user.setFullName(fullNameText);
    user.setEmail(emailText);
    user.setPassword(passwordText);
    showProgress();
    if (isNeedUpdateAvatar) {
      new ReceiveImageFileTask(this).execute(imageUtils,avatarBitmapCurrent,true);
    }
 else {
      App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,false);
      QBSignUpCommand.start(SignUpActivity.this,user,null);
    }
  }
}
Program: 114421
Project: 114421
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == ImageCropperActivity.ACTIVITY_RESULT_CODE) {
    if (resultCode == RESULT_OK) {
      isNeedUpdateAvatar=true;
      String filePath=data.getStringExtra(QBServiceConsts.EXTRA_FILE_PATH);
      avatarBitmapCurrent=BitmapFactory.decodeFile(filePath);
      imageHelper.removeFile(filePath);
      avatarImageView.setImageBitmap(avatarBitmapCurrent);
    }
  }
 else   if (requestCode == ImageHelper.GALLERY_INTENT_CALLED) {
    if (resultCode == RESULT_OK) {
      Uri originalUri=data.getData();
      if (originalUri != null) {
        startCropActivity(originalUri);
      }
    }
  }
  super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == ImageCropperActivity.INTENT_RESULT_CODE) {
    if (resultCode == RESULT_OK) {
      isNeedUpdateAvatar=true;
      String filePath=data.getStringExtra(QBServiceConsts.EXTRA_FILE_PATH);
      avatarBitmapCurrent=BitmapFactory.decodeFile(filePath);
      FileUtils.removeFile(filePath);
      avatarImageView.setImageBitmap(avatarBitmapCurrent);
    }
  }
 else   if (requestCode == ImageUtils.GALLERY_INTENT_CALLED) {
    if (resultCode == RESULT_OK) {
      Uri originalUri=data.getData();
      if (originalUri != null) {
        startCropActivity(originalUri);
      }
    }
  }
  super.onActivityResult(requestCode,resultCode,data);
}
Program: 114422
Project: 114422
Buggy source:
public void changeAvatarOnClickListener(View view){
  imageHelper.getImage();
}

Fixed version (ground truth):
public void changeAvatarOnClickListener(View view){
  imageUtils.getImage();
}
Program: 114423
Project: 114423
Buggy source:
private boolean isGalleryCalled(int requestCode){
  return ImageHelper.GALLERY_INTENT_CALLED == requestCode;
}

Fixed version (ground truth):
private boolean isGalleryCalled(int requestCode){
  return ImageUtils.GALLERY_INTENT_CALLED == requestCode;
}
Program: 114424
Project: 114424
Buggy source:
protected void attachButtonOnClick(){
  canPerformLogout.set(false);
  imageHelper.getImage();
}

Fixed version (ground truth):
protected void attachButtonOnClick(){
  canPerformLogout.set(false);
  imageUtils.getImage();
}
Program: 114425
Project: 114425
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  rootView=getLayoutInflater().inflate(layoutResID,null);
  setContentView(rootView);
  imageHelper=new ImageHelper(this);
  loadAttachFileSuccessAction=new LoadAttachFileSuccessAction();
  initUI();
  initListeners();
  initActionBar();
  initBitmapOption();
  addActions();
  isNeedToScrollMessages=true;
  hideSmileLayout();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  rootView=getLayoutInflater().inflate(layoutResID,null);
  setContentView(rootView);
  imageUtils=new ImageUtils(this);
  loadAttachFileSuccessAction=new LoadAttachFileSuccessAction();
  initUI();
  initListeners();
  initActionBar();
  initBitmapOption();
  addActions();
  isNeedToScrollMessages=true;
  hideSmileLayout();
}
Program: 114426
Project: 114426
Buggy source:
@Override public void onClick(View view){
  view.startAnimation(AnimationUtils.loadAnimation(context,R.anim.chat_attached_file_click));
  new ReceiveImageFileTask(BaseDialogMessagesAdapter.this).execute(imageHelper,loadedImageBitmap,false);
}

Fixed version (ground truth):
@Override public void onClick(View view){
  view.startAnimation(AnimationUtils.loadAnimation(context,R.anim.chat_attached_file_click));
  new ReceiveImageFileTask(BaseDialogMessagesAdapter.this).execute(imageUtils,loadedImageBitmap,false);
}
Program: 114427
Project: 114427
Buggy source:
@Override public void onAbsolutePathExtFileReceived(String absolutePath){
  imageHelper.showFullImage(context,absolutePath);
}

Fixed version (ground truth):
@Override public void onAbsolutePathExtFileReceived(String absolutePath){
  imageUtils.showFullImage(context,absolutePath);
}
Program: 114428
Project: 114428
Buggy source:
private View.OnClickListener receiveImageFileOnClickListener(){
  return new View.OnClickListener(){
    @Override public void onClick(    View view){
      view.startAnimation(AnimationUtils.loadAnimation(context,R.anim.chat_attached_file_click));
      new ReceiveImageFileTask(BaseDialogMessagesAdapter.this).execute(imageHelper,loadedImageBitmap,false);
    }
  }
;
}

Fixed version (ground truth):
private View.OnClickListener receiveImageFileOnClickListener(){
  return new View.OnClickListener(){
    @Override public void onClick(    View view){
      view.startAnimation(AnimationUtils.loadAnimation(context,R.anim.chat_attached_file_click));
      new ReceiveImageFileTask(BaseDialogMessagesAdapter.this).execute(imageUtils,loadedImageBitmap,false);
    }
  }
;
}