nus-yam/ex-repair huggingface dataset:
Program: 114643
Project: 114643
Buggy source:
@Override public Cursor query(Uri uri,String[] projection,String selection,String[] selectionArgs,String sortOrder){
  SQLiteDatabase db=dbHelper.getReadableDatabase();
  final int token=ContentDescriptor.URI_MATCHER.match(uri);
  Cursor result=null;
switch (token) {
case FriendTable.PATH_TOKEN:
{
      result=doQuery(db,uri,FriendTable.TABLE_NAME,projection,selection,selectionArgs,sortOrder);
      break;
    }
case ChatMessagesTable.PATH_TOKEN:
{
    result=doQuery(db,uri,ChatMessagesTable.TABLE_NAME,projection,selection,selectionArgs,sortOrder);
    break;
  }
}
return result;
}

Fixed version (ground truth):
@Override public Cursor query(Uri uri,String[] projection,String selection,String[] selectionArgs,String sortOrder){
  SQLiteDatabase db=dbHelper.getReadableDatabase();
  final int token=ContentDescriptor.URI_MATCHER.match(uri);
  Cursor result=null;
switch (token) {
case FriendTable.PATH_TOKEN:
{
      result=doQuery(db,uri,FriendTable.TABLE_NAME,projection,selection,selectionArgs,sortOrder);
      break;
    }
case ChatMessageTable.PATH_TOKEN:
{
    result=doQuery(db,uri,ChatMessageTable.TABLE_NAME,projection,selection,selectionArgs,sortOrder);
    break;
  }
case ChatTable.PATH_TOKEN:
{
  result=doQuery(db,uri,ChatTable.TABLE_NAME,projection,selection,selectionArgs,sortOrder);
  break;
}
}
return result;
}
Program: 114644
Project: 114644
Buggy source:
@Override public int bulkInsert(Uri uri,ContentValues[] values){
  String table=null;
  int token=ContentDescriptor.URI_MATCHER.match(uri);
switch (token) {
case FriendTable.PATH_TOKEN:
{
      table=FriendTable.TABLE_NAME;
      break;
    }
case ChatMessagesTable.PATH_TOKEN:
{
    table=ChatMessagesTable.TABLE_NAME;
    break;
  }
}
SQLiteDatabase db=dbHelper.getWritableDatabase();
db.beginTransaction();
for (ContentValues cv : values) {
db.insert(table,null,cv);
}
db.setTransactionSuccessful();
db.endTransaction();
return values.length;
}

Fixed version (ground truth):
@Override public int bulkInsert(Uri uri,ContentValues[] values){
  String table=null;
  int token=ContentDescriptor.URI_MATCHER.match(uri);
switch (token) {
case FriendTable.PATH_TOKEN:
{
      table=FriendTable.TABLE_NAME;
      break;
    }
case ChatMessageTable.PATH_TOKEN:
{
    table=ChatMessageTable.TABLE_NAME;
    break;
  }
case ChatTable.PATH_TOKEN:
{
  table=ChatTable.TABLE_NAME;
  break;
}
}
SQLiteDatabase db=dbHelper.getWritableDatabase();
db.beginTransaction();
for (ContentValues cv : values) {
db.insert(table,null,cv);
}
db.setTransactionSuccessful();
db.endTransaction();
return values.length;
}
Program: 114645
Project: 114645
Buggy source:
@Override public Uri insert(Uri uri,ContentValues values){
  SQLiteDatabase db=dbHelper.getWritableDatabase();
  int token=ContentDescriptor.URI_MATCHER.match(uri);
  Uri result=null;
switch (token) {
case FriendTable.PATH_TOKEN:
{
      result=doInsert(db,FriendTable.TABLE_NAME,FriendTable.CONTENT_URI,uri,values);
      break;
    }
case ChatMessagesTable.PATH_TOKEN:
{
    result=doInsert(db,ChatMessagesTable.TABLE_NAME,ChatMessagesTable.CONTENT_URI,uri,values);
    break;
  }
}
if (result == null) {
throw new IllegalArgumentException(UNKNOWN_URI + uri);
}
return result;
}

Fixed version (ground truth):
@Override public Uri insert(Uri uri,ContentValues values){
  SQLiteDatabase db=dbHelper.getWritableDatabase();
  int token=ContentDescriptor.URI_MATCHER.match(uri);
  Uri result=null;
switch (token) {
case FriendTable.PATH_TOKEN:
{
      result=doInsert(db,FriendTable.TABLE_NAME,FriendTable.CONTENT_URI,uri,values);
      break;
    }
case ChatMessageTable.PATH_TOKEN:
{
    result=doInsert(db,ChatMessageTable.TABLE_NAME,ChatMessageTable.CONTENT_URI,uri,values);
    break;
  }
case ChatTable.PATH_TOKEN:
{
  result=doInsert(db,ChatTable.TABLE_NAME,ChatTable.CONTENT_URI,uri,values);
  break;
}
}
if (result == null) {
throw new IllegalArgumentException(UNKNOWN_URI + uri);
}
return result;
}
Program: 114646
Project: 114646
Buggy source:
@Override public int update(Uri uri,ContentValues values,String selection,String[] selectionArgs){
  SQLiteDatabase db=dbHelper.getWritableDatabase();
  int token=ContentDescriptor.URI_MATCHER.match(uri);
  int result=0;
switch (token) {
case FriendTable.PATH_TOKEN:
{
      result=doUpdate(db,uri,FriendTable.TABLE_NAME,selection,selectionArgs,values);
      break;
    }
case ChatMessagesTable.PATH_TOKEN:
{
    result=doUpdate(db,uri,ChatMessagesTable.TABLE_NAME,selection,selectionArgs,values);
    break;
  }
}
return result;
}

Fixed version (ground truth):
@Override public int update(Uri uri,ContentValues values,String selection,String[] selectionArgs){
  SQLiteDatabase db=dbHelper.getWritableDatabase();
  int token=ContentDescriptor.URI_MATCHER.match(uri);
  int result=Consts.ZERO_VALUE;
switch (token) {
case FriendTable.PATH_TOKEN:
{
      result=doUpdate(db,uri,FriendTable.TABLE_NAME,selection,selectionArgs,values);
      break;
    }
case ChatMessageTable.PATH_TOKEN:
{
    result=doUpdate(db,uri,ChatMessageTable.TABLE_NAME,selection,selectionArgs,values);
    break;
  }
case ChatTable.PATH_TOKEN:
{
  result=doUpdate(db,uri,ChatTable.TABLE_NAME,selection,selectionArgs,values);
  break;
}
}
return result;
}
Program: 114647
Project: 114647
Buggy source:
@Override public int delete(Uri uri,String selection,String[] selectionArgs){
  SQLiteDatabase db=dbHelper.getWritableDatabase();
  int token=ContentDescriptor.URI_MATCHER.match(uri);
  int result=0;
switch (token) {
case FriendTable.PATH_TOKEN:
{
      result=doDelete(db,uri,FriendTable.TABLE_NAME,selection,selectionArgs);
      break;
    }
case ChatMessagesTable.PATH_TOKEN:
{
    result=doDelete(db,uri,ChatMessagesTable.TABLE_NAME,selection,selectionArgs);
    break;
  }
}
return result;
}

Fixed version (ground truth):
@Override public int delete(Uri uri,String selection,String[] selectionArgs){
  SQLiteDatabase db=dbHelper.getWritableDatabase();
  int token=ContentDescriptor.URI_MATCHER.match(uri);
  int result=Consts.ZERO_VALUE;
switch (token) {
case FriendTable.PATH_TOKEN:
{
      result=doDelete(db,uri,FriendTable.TABLE_NAME,selection,selectionArgs);
      break;
    }
case ChatMessageTable.PATH_TOKEN:
{
    result=doDelete(db,uri,ChatMessageTable.TABLE_NAME,selection,selectionArgs);
    break;
  }
case ChatTable.PATH_TOKEN:
{
  result=doDelete(db,uri,ChatTable.TABLE_NAME,selection,selectionArgs);
  break;
}
}
return result;
}
Program: 114648
Project: 114648
Buggy source:
public static void saveChatMessages(Context context,List<QBHistoryMessage> messagesList,String roomJidId){
  for (  QBHistoryMessage historyMessage : messagesList) {
    String message=historyMessage.getBody();
    int senderId=historyMessage.getSenderId();
    String attachURL;
    if (TextUtils.isEmpty(message)) {
      attachURL=ChatUtils.getAttachUrlFromMessage(historyMessage.getAttachments());
    }
 else {
      attachURL=Consts.EMPTY_STRING;
    }
    DialogMessageCache dialogMessageCache=new DialogMessageCache(roomJidId,senderId,message,attachURL);
    saveChatMessage(context,dialogMessageCache);
  }
}

Fixed version (ground truth):
public static void saveChatMessages(Context context,List<QBHistoryMessage> messagesList,String roomJidId){
  for (  QBHistoryMessage historyMessage : messagesList) {
    String message=historyMessage.getBody();
    int senderId=historyMessage.getSenderId();
    String attachURL;
    if (TextUtils.isEmpty(message)) {
      attachURL=ChatUtils.getAttachUrlFromMessage(historyMessage.getAttachments());
    }
 else {
      attachURL=Consts.EMPTY_STRING;
    }
    DialogMessageCache dialogMessageCache=new DialogMessageCache(roomJidId,senderId,message,attachURL,historyMessage.getDateSent());
    saveChatMessage(context,dialogMessageCache);
  }
}
Program: 114649
Project: 114649
Buggy source:
public static void saveChatMessage(Context context,DialogMessageCache dialogMessageCache){
  unreadMessagesCount++;
  ContentValues values=new ContentValues();
  values.put(DialogMessageTable.Cols.ROOM_JID_ID,dialogMessageCache.getRoomJidId());
  values.put(DialogMessageTable.Cols.SENDER_ID,dialogMessageCache.getSenderId());
  values.put(DialogMessageTable.Cols.BODY,dialogMessageCache.getMessage());
  values.put(DialogMessageTable.Cols.TIME,System.currentTimeMillis());
  values.put(DialogMessageTable.Cols.ATTACH_FILE_ID,dialogMessageCache.getAttachUrl());
  context.getContentResolver().insert(DialogMessageTable.CONTENT_URI,values);
  updateUnreadMessagesCount(context,dialogMessageCache.getRoomJidId(),dialogMessageCache.getMessage());
}

Fixed version (ground truth):
public static void saveChatMessage(Context context,DialogMessageCache dialogMessageCache){
  unreadMessagesCount++;
  ContentValues values=new ContentValues();
  values.put(DialogMessageTable.Cols.ROOM_JID_ID,dialogMessageCache.getRoomJidId());
  values.put(DialogMessageTable.Cols.SENDER_ID,dialogMessageCache.getSenderId());
  values.put(DialogMessageTable.Cols.BODY,dialogMessageCache.getMessage());
  values.put(DialogMessageTable.Cols.TIME,dialogMessageCache.getTime());
  values.put(DialogMessageTable.Cols.ATTACH_FILE_ID,dialogMessageCache.getAttachUrl());
  context.getContentResolver().insert(DialogMessageTable.CONTENT_URI,values);
  updateUnreadMessagesCount(context,dialogMessageCache.getRoomJidId(),dialogMessageCache.getMessage());
}
Program: 114650
Project: 114650
Buggy source:
public static QBDialog getQBDialogByRoomJidId(Context context,String roomJidId){
  QBDialog dialog;
  Cursor cursor=context.getContentResolver().query(DialogTable.CONTENT_URI,null,DialogTable.Cols.ROOM_JID_ID + "String_Node_Str" + roomJidId+ "String_Node_Str",null,null);
  if (cursor != null && cursor.moveToFirst()) {
    dialog=getQBDialogFromCursor(cursor);
  }
 else {
    dialog=new QBDialog(null);
    dialog.setRoomJid(roomJidId);
    Friend opponentFriend=getFriendById(context,Integer.parseInt(roomJidId));
    dialog.setName(opponentFriend.getFullname());
    saveDialog(context,dialog,roomJidId);
  }
  return dialog;
}

Fixed version (ground truth):
public static QBDialog getQBDialogByRoomJidId(Context context,String roomJidId){
  QBDialog dialog;
  Cursor cursor=context.getContentResolver().query(DialogTable.CONTENT_URI,null,DialogTable.Cols.ROOM_JID_ID + "String_Node_Str" + roomJidId+ "String_Node_Str",null,null);
  if (cursor != null && cursor.moveToFirst()) {
    dialog=getQBDialogFromCursor(cursor);
  }
 else {
    dialog=new QBDialog(Consts.EMPTY_STRING);
    dialog.setRoomJid(roomJidId);
    Friend opponentFriend=getFriendById(context,Integer.parseInt(roomJidId));
    dialog.setName(opponentFriend.getFullname());
    ArrayList<Integer> occupantsIdsList=ChatUtils.getOccupantsIdsListForCreatePrivateDialog(opponentFriend.getId());
    dialog.setOccupantsIds(occupantsIdsList);
    saveDialog(context,dialog,roomJidId);
  }
  return dialog;
}
Program: 114651
Project: 114651
Buggy source:
public DialogMessageCache(String roomJidId,int senderId,String message,String attachUrl){
  this.roomJidId=roomJidId;
  this.senderId=senderId;
  this.message=message;
  this.attachUrl=attachUrl;
}

Fixed version (ground truth):
public DialogMessageCache(String roomJidId,int senderId,String message,String attachUrl,long time){
  this.roomJidId=roomJidId;
  this.senderId=senderId;
  this.message=message;
  this.attachUrl=attachUrl;
  this.time=time;
}
Program: 114652
Project: 114652
Buggy source:
public void sendPrivateMessage(String message) throws XMPPException, SmackException.NotConnectedException {
  QBChatMessage chatMessage=getQBChatMessage(message);
  privateChat.sendMessage(chatMessage);
  String roomJidId=opponentId + Consts.EMPTY_STRING;
  String attachUrl=Consts.EMPTY_STRING;
  saveMessageToCache(new DialogMessageCache(roomJidId,user.getId(),chatMessage.getBody(),attachUrl));
}

Fixed version (ground truth):
public void sendPrivateMessage(String message) throws XMPPException, SmackException.NotConnectedException {
  QBChatMessage chatMessage=getQBChatMessage(message);
  privateChat.sendMessage(chatMessage);
  String roomJidId=opponentId + Consts.EMPTY_STRING;
  String attachUrl=Consts.EMPTY_STRING;
  saveMessageToCache(new DialogMessageCache(roomJidId,user.getId(),chatMessage.getBody(),attachUrl,System.currentTimeMillis()));
}
Program: 114653
Project: 114653
Buggy source:
@Override public void processMessage(QBRoomChat roomChat,QBChatMessage chatMessage){
  Friend friend=DatabaseManager.getFriendById(context,chatMessage.getSenderId());
  String attachURL=getAttachUrlIfExists(chatMessage);
  saveMessageToCache(new DialogMessageCache(roomChat.getJid(),chatMessage.getSenderId(),chatMessage.getBody(),attachURL));
  if (!chatMessage.getSenderId().equals(user.getId())) {
    notifyMessageReceived(chatMessage,friend);
  }
}

Fixed version (ground truth):
@Override public void processMessage(QBRoomChat roomChat,QBChatMessage chatMessage){
  Friend friend=DatabaseManager.getFriendById(context,chatMessage.getSenderId());
  String attachURL=getAttachUrlIfExists(chatMessage);
  saveMessageToCache(new DialogMessageCache(roomChat.getJid(),chatMessage.getSenderId(),chatMessage.getBody(),attachURL,System.currentTimeMillis()));
  if (!chatMessage.getSenderId().equals(user.getId())) {
    notifyMessageReceived(chatMessage,friend);
  }
}
Program: 114654
Project: 114654
Buggy source:
public void sendPrivateMessageWithAttachImage(QBFile qbFile) throws XMPPException, SmackException.NotConnectedException {
  QBChatMessage chatMessage=getQBChatMessageWithImage(qbFile);
  privateChat.sendMessage(chatMessage);
  String roomJidId=opponentId + Consts.EMPTY_STRING;
  String attachUrl=qbFile.getPublicUrl();
  saveMessageToCache(new DialogMessageCache(roomJidId,user.getId(),chatMessage.getBody(),attachUrl));
}

Fixed version (ground truth):
public void sendPrivateMessageWithAttachImage(QBFile qbFile) throws XMPPException, SmackException.NotConnectedException {
  QBChatMessage chatMessage=getQBChatMessageWithImage(qbFile);
  privateChat.sendMessage(chatMessage);
  String roomJidId=opponentId + Consts.EMPTY_STRING;
  String attachUrl=qbFile.getPublicUrl();
  saveMessageToCache(new DialogMessageCache(roomJidId,user.getId(),chatMessage.getBody(),attachUrl,System.currentTimeMillis()));
}
Program: 114655
Project: 114655
Buggy source:
@Override public void execute(Bundle bundle){
  Exception e=(Exception)bundle.getSerializable(QBServiceConsts.EXTRA_ERROR);
  ErrorUtils.logError(e);
  hideProgress();
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  Exception e=(Exception)bundle.getSerializable(QBServiceConsts.EXTRA_ERROR);
  ErrorUtils.showError(BaseActivity.this,e);
  hideProgress();
}
Program: 114656
Project: 114656
Buggy source:
public static void showError(Context context,String error){
  Toast.makeText(context,error,Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
public static void showError(Context context,String error){
  Toast.makeText(context,error,Toast.LENGTH_LONG).show();
}
Program: 114657
Project: 114657
Buggy source:
public static void saveChatMessages(Context context,List<QBHistoryMessage> messagesList,String roomJidId){
  for (  QBHistoryMessage historyMessage : messagesList) {
    String message=historyMessage.getBody();
    int senderId=historyMessage.getSenderId();
    String attachURL;
    if (TextUtils.isEmpty(message)) {
      attachURL=ChatUtils.getAttachUrlFromMessage(historyMessage.getAttachments());
    }
 else {
      attachURL=Consts.EMPTY_STRING;
    }
    if (TextUtils.isEmpty(message) && TextUtils.isEmpty(attachURL)) {
      Friend friend=DatabaseManager.getFriendById(context,senderId);
      message=context.getResources().getString(R.string.user_created_room,friend.getFullname());
    }
    DialogMessageCache dialogMessageCache=new DialogMessageCache(roomJidId,senderId,message,attachURL,historyMessage.getDateSent());
    saveChatMessage(context,dialogMessageCache);
  }
}

Fixed version (ground truth):
public static void saveChatMessages(Context context,List<QBHistoryMessage> messagesList,String roomJidId){
  for (  QBHistoryMessage historyMessage : messagesList) {
    String message=historyMessage.getBody();
    int senderId=historyMessage.getSenderId();
    String attachURL;
    if (TextUtils.isEmpty(message)) {
      attachURL=ChatUtils.getAttachUrlFromMessage(historyMessage.getAttachments());
    }
 else {
      attachURL=Consts.EMPTY_STRING;
    }
    if (TextUtils.isEmpty(message) && TextUtils.isEmpty(attachURL)) {
      Friend friend=DatabaseManager.getFriendById(context,senderId);
      if (friend == null) {
        message=context.getResources().getString(R.string.user_created_room,senderId);
      }
 else {
        message=context.getResources().getString(R.string.user_created_room,friend.getFullname());
      }
    }
    DialogMessageCache dialogMessageCache=new DialogMessageCache(roomJidId,senderId,message,attachURL,historyMessage.getDateSent());
    saveChatMessage(context,dialogMessageCache);
  }
}
Program: 114658
Project: 114658
Buggy source:
public static Dialog createTempDialogByRoomJidId(Context context,String roomJidId){
  Dialog dialog=new Dialog();
  dialog.setRoomJidId(roomJidId);
  Friend opponentFriend=getFriendById(context,Integer.parseInt(roomJidId));
  dialog.setName(opponentFriend.getFullname());
  ArrayList<Integer> occupantsIdsList=ChatUtils.getOccupantsIdsListForCreatePrivateDialog(opponentFriend.getId());
  dialog.setOccupantsIds(occupantsIdsList);
  dialog.setType(QBDialogType.PRIVATE);
  createTempDialog(context,dialog,roomJidId);
  return dialog;
}

Fixed version (ground truth):
public static QBDialog createTempDialogByRoomJidId(Context context,String roomJidId){
  QBDialog dialog=new QBDialog();
  dialog.setRoomJid(roomJidId);
  Friend opponentFriend=getFriendById(context,Integer.parseInt(roomJidId));
  dialog.setName(opponentFriend.getFullname());
  ArrayList<Integer> occupantsIdsList=ChatUtils.getOccupantsIdsListForCreatePrivateDialog(opponentFriend.getId());
  dialog.setOccupantsIds(occupantsIdsList);
  dialog.setType(QBDialogType.PRIVATE);
  saveDialog(context,dialog,roomJidId);
  return dialog;
}
Program: 114659
Project: 114659
Buggy source:
public static void start(Context context,Dialog dialog,String roomJidId,boolean isTempDialog){
  Intent intent=new Intent(QBServiceConsts.UPDATE_CHAT_DIALOG_ACTION,null,context,QBService.class);
  intent.putExtra(QBServiceConsts.EXTRA_ROOM_JID_ID,roomJidId);
  intent.putExtra(QBServiceConsts.EXTRA_DIALOG,dialog);
  intent.putExtra(QBServiceConsts.EXTRA_IS_TEMP_DIALOG,isTempDialog);
  context.startService(intent);
}

Fixed version (ground truth):
public static void start(Context context,QBDialog dialog,String roomJidId){
  Intent intent=new Intent(QBServiceConsts.UPDATE_CHAT_DIALOG_ACTION,null,context,QBService.class);
  intent.putExtra(QBServiceConsts.EXTRA_ROOM_JID_ID,roomJidId);
  intent.putExtra(QBServiceConsts.EXTRA_DIALOG,dialog);
  context.startService(intent);
}
Program: 114660
Project: 114660
Buggy source:
@Override public Bundle perform(Bundle extras) throws Exception {
  boolean isTempDialog=extras.getBoolean(QBServiceConsts.EXTRA_IS_TEMP_DIALOG);
  String roomJidId=extras.getString(QBServiceConsts.EXTRA_ROOM_JID_ID);
  if (isTempDialog) {
    Dialog dialog=(Dialog)extras.getSerializable(QBServiceConsts.EXTRA_DIALOG);
    chatHelper.updateTempDialog(dialog,roomJidId);
  }
 else {
    QBDialog dialog=(QBDialog)extras.getSerializable(QBServiceConsts.EXTRA_DIALOG);
    chatHelper.updateDialog(dialog,roomJidId);
  }
  return null;
}

Fixed version (ground truth):
@Override public Bundle perform(Bundle extras) throws Exception {
  String roomJidId=extras.getString(QBServiceConsts.EXTRA_ROOM_JID_ID);
  QBDialog dialog=(QBDialog)extras.getSerializable(QBServiceConsts.EXTRA_DIALOG);
  chatHelper.updateDialog(dialog,roomJidId);
  return null;
}
Program: 114661
Project: 114661
Buggy source:
public List<QBHistoryMessage> getDialogMessages(QBDialog dialog,String roomJidId) throws QBResponseException {
  Bundle bundle=new Bundle();
  QBCustomObjectRequestBuilder customObjectRequestBuilder=new QBCustomObjectRequestBuilder();
  customObjectRequestBuilder.setPagesLimit(Consts.DIALOG_MESSAGES_PER_PAGE);
  List<QBHistoryMessage> dialogMessagesList=QBChatService.getDialogMessages(dialog,customObjectRequestBuilder,bundle);
  deleteMessagesByRoomJidId(roomJidId);
  saveChatMessagesToCache(dialogMessagesList,roomJidId);
  return dialogMessagesList;
}

Fixed version (ground truth):
public List<QBHistoryMessage> getDialogMessages(QBDialog dialog,String roomJidId) throws QBResponseException {
  Bundle bundle=new Bundle();
  QBCustomObjectRequestBuilder customObjectRequestBuilder=new QBCustomObjectRequestBuilder();
  customObjectRequestBuilder.setPagesLimit(Consts.DIALOG_MESSAGES_PER_PAGE);
  List<QBHistoryMessage> dialogMessagesList=QBChatService.getDialogMessages(dialog,customObjectRequestBuilder,bundle);
  if (dialogMessagesList != null) {
    deleteMessagesByRoomJidId(roomJidId);
    saveChatMessagesToCache(dialogMessagesList,roomJidId);
  }
  return dialogMessagesList;
}
Program: 114662
Project: 114662
Buggy source:
private void startUpdateChatDialog(){
  if (dialog != null) {
    QBUpdateDialogCommand.start(this,getDialog(),roomJidId);
  }
 else {
    QBUpdateDialogCommand.start(this,getTempDialog(),roomJidId,true);
  }
}

Fixed version (ground truth):
private void startUpdateChatDialog(){
  if (dialog != null) {
    QBUpdateDialogCommand.start(this,getDialog(),roomJidId);
  }
}
Program: 114663
Project: 114663
Buggy source:
@Override public void processMessage(QBRoomChat roomChat,QBChatMessage chatMessage){
  Friend friend=DatabaseManager.getFriendById(context,chatMessage.getSenderId());
  saveGroupMessageToCache(chatMessage,chatMessage.getSenderId(),roomChat.getJid());
  if (!chatMessage.getSenderId().equals(user.getId())) {
    notifyMessageReceived(chatMessage,friend);
  }
  updateLoadedChatDialog(chatMessage.getSenderId(),chatMessage.getBody(),-1);
}

Fixed version (ground truth):
@Override public void processMessage(QBRoomChat roomChat,QBChatMessage chatMessage){
  Friend friend=DatabaseManager.getFriendById(context,chatMessage.getSenderId());
  saveGroupMessageToCache(chatMessage,chatMessage.getSenderId(),roomChat.getJid());
  if (!chatMessage.getSenderId().equals(user.getId())) {
    notifyMessageReceived(chatMessage,friend);
  }
}
Program: 114664
Project: 114664
Buggy source:
public void sendPrivateMessageWithAttachImage(QBFile qbFile) throws XMPPException, SmackException.NotConnectedException {
  QBChatMessage chatMessage=getQBChatMessageWithImage(qbFile);
  privateChat.sendMessage(chatMessage);
  saveMessageToCache(new ChatMessageCache(Consts.EMPTY_STRING,user.getId(),String.valueOf(privateChatId),qbFile.getPublicUrl()));
}

Fixed version (ground truth):
public void sendPrivateMessageWithAttachImage(QBFile qbFile) throws XMPPException, SmackException.NotConnectedException {
  QBChatMessage chatMessage=getQBChatMessageWithImage(qbFile);
  privateChat.sendMessage(chatMessage);
  saveMessageToCache(new ChatMessageCache(Consts.EMPTY_STRING,user.getId(),privateChatId,qbFile.getPublicUrl()));
}
Program: 114665
Project: 114665
Buggy source:
private void notifyFriendAboutInvitation(QBDialog dialog,Integer friendId) throws XMPPException, SmackException {
  QBPrivateChat chat=privateChatManager.createChat(friendId,new PrivateChatMessageListener());
  QBChatMessage message=createRoomNotificationMessage(dialog);
  chat.sendMessage(message);
  Log.d(TAG,"String_Node_Str" + friendId);
}

Fixed version (ground truth):
private void notifyFriendAboutInvitation(QBDialog dialog,Integer friendId) throws XMPPException, SmackException {
  QBPrivateChat chat=privateChatManager.createChat(friendId,privateChatMessageListener);
  QBChatMessage message=createRoomNotificationMessage(dialog);
  chat.sendMessage(message);
  Log.d(TAG,"String_Node_Str" + friendId);
}
Program: 114666
Project: 114666
Buggy source:
public QBFile loadAttachFile(File file){
  QBFile qbFile=null;
  try {
    qbFile=QBContent.uploadFileTask(file,true,(String)null);
  }
 catch (  QBResponseException e) {
    ErrorUtils.showError(context,e);
  }
  return qbFile;
}

Fixed version (ground truth):
public QBFile loadAttachFile(File file){
  QBFile qbFile=null;
  try {
    qbFile=QBContent.uploadFileTask(file,true,(String)null);
  }
 catch (  QBResponseException e) {
    ErrorUtils.logError(e);
  }
  return qbFile;
}
Program: 114667
Project: 114667
Buggy source:
private void registerLoadAttachFileCommand(){
  ServiceCommand loadFriendListCommand=new QBLoadFriendListCommand(this,friendListHelper,QBServiceConsts.LOAD_ATTACH_FILE_SUCCESS_ACTION,QBServiceConsts.LOAD_ATTACH_FILE_FAIL_ACTION);
  serviceCommandMap.put(QBServiceConsts.LOAD_ATTACH_FILE_ACTION,loadFriendListCommand);
}

Fixed version (ground truth):
private void registerLoadAttachFileCommand(){
  ServiceCommand loadAttachFileCommand=new QBLoadAttachFileCommand(this,chatHelper,QBServiceConsts.LOAD_ATTACH_FILE_SUCCESS_ACTION,QBServiceConsts.LOAD_ATTACH_FILE_FAIL_ACTION);
  serviceCommandMap.put(QBServiceConsts.LOAD_ATTACH_FILE_ACTION,loadAttachFileCommand);
}
Program: 114668
Project: 114668
Buggy source:
private void addNewChatDialog(int occupantId,String lastMessage,QBDialogType type){
  QBDialog newDialog=new QBDialog();
  newDialog.setId(occupantId);
  newDialog.setLastMessage(lastMessage);
  ArrayList occupantsIdsList=new ArrayList<Integer>();
  occupantsIdsList.add(App.getInstance().getUser().getId());
  occupantsIdsList.add(occupantId);
  newDialog.setOccupantsIds(occupantsIdsList);
  newDialog.setUnreadMessageCount(Consts.ZERO_VALUE);
  newDialog.setType(type);
  chatsDialogsList.add(newDialog);
}

Fixed version (ground truth):
private void addNewChatDialog(int occupantId,String lastMessage,QBDialogType type){
  QBDialog newDialog=new QBDialog(occupantId + Consts.EMPTY_STRING);
  newDialog.setLastMessage(lastMessage);
  ArrayList occupantsIdsList=new ArrayList<Integer>();
  occupantsIdsList.add(App.getInstance().getUser().getId());
  occupantsIdsList.add(occupantId);
  newDialog.setOccupantsIds(occupantsIdsList);
  newDialog.setUnreadMessageCount(Consts.ZERO_VALUE);
  newDialog.setType(type);
  chatsDialogsList.add(newDialog);
}
Program: 114669
Project: 114669
Buggy source:
public List<QBDialog> getChatsDialogs(){
  Bundle bundle=new Bundle();
  try {
    QBCustomObjectRequestBuilder customObjectRequestBuilder=new QBCustomObjectRequestBuilder();
    customObjectRequestBuilder.setPagesLimit(Consts.CHATS_DIALOGS_PER_PAGE);
    chatsDialogsList=QBChatService.getChatDialogs(null,customObjectRequestBuilder,bundle);
  }
 catch (  QBResponseException e) {
    e.printStackTrace();
  }
  return chatsDialogsList;
}

Fixed version (ground truth):
public List<QBDialog> getChatsDialogs() throws QBResponseException {
  Bundle bundle=new Bundle();
  QBCustomObjectRequestBuilder customObjectRequestBuilder=new QBCustomObjectRequestBuilder();
  customObjectRequestBuilder.setPagesLimit(Consts.CHATS_DIALOGS_PER_PAGE);
  chatsDialogsList=QBChatService.getChatDialogs(null,customObjectRequestBuilder,bundle);
  return chatsDialogsList;
}
Program: 114670
Project: 114670
Buggy source:
@Override public boolean onMenuItemActionCollapse(MenuItem item){
  state=State.FRIENDS_LIST;
  baseActivity.getActionBar().setDisplayShowHomeEnabled(true);
  if (isHideSearchView) {
    isHideSearchView=false;
    friendsListAdapter.setSearchCharacters(null);
    friendsListAdapter.setFilterQueryProvider(null);
    friendsListView.removeFooterView(globalSearchLayout);
    friendsListView.removeHeaderView(friendsListViewTitle);
    positionCounter--;
    initFriendsList();
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemActionCollapse(MenuItem item){
  state=State.FRIENDS_LIST;
  baseActivity.getActionBar().setDisplayShowHomeEnabled(true);
  if (isHideSearchView) {
    isHideSearchView=false;
    emptyListTextView.setVisibility(friendsListAdapter.isEmpty() ? View.VISIBLE : View.GONE);
    friendsListAdapter.setSearchCharacters(null);
    friendsListAdapter.setFilterQueryProvider(null);
    friendsListView.removeFooterView(globalSearchLayout);
    friendsListView.removeHeaderView(friendsListViewTitle);
    positionCounter--;
    initFriendsList();
  }
  return true;
}
Program: 114671
Project: 114671
Buggy source:
private void initUI(View view,LayoutInflater layoutInflater){
  friendsListView=(ListView)view.findViewById(R.id.friendList);
  friendsListViewTitle=layoutInflater.inflate(R.layout.view_section_title_friends_list,null);
  friendsTitle=(TextView)friendsListViewTitle.findViewById(R.id.listTitle);
}

Fixed version (ground truth):
private void initUI(View view,LayoutInflater layoutInflater){
  friendsListView=(ListView)view.findViewById(R.id.friends_listview);
  friendsListViewTitle=layoutInflater.inflate(R.layout.view_section_title_friends_list,null);
  friendsTitle=(TextView)friendsListViewTitle.findViewById(R.id.listTitle);
  emptyListTextView=(TextView)view.findViewById(R.id.empty_list_textview);
}
Program: 114672
Project: 114672
Buggy source:
@Override public boolean onMenuItemActionExpand(MenuItem item){
  isHideSearchView=true;
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemActionExpand(MenuItem item){
  isHideSearchView=true;
  emptyListTextView.setVisibility(View.GONE);
  return true;
}
Program: 114673
Project: 114673
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder viewHolder;
  final QBDialog data=getItem(position);
  if (convertView == null) {
    convertView=layoutInflater.inflate(R.layout.list_item_chat,null);
    viewHolder=createViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
 else {
    viewHolder=(ViewHolder)convertView.getTag();
  }
  if (data.getType() == QBDialogType.PRIVATE) {
    int occupantId=ChatUtils.getOccupantsIdsFromDialog(data).get(Consts.ZERO_VALUE);
    Friend occupant=getOccupantById(occupantId);
    viewHolder.nameTextView.setText(occupant.getFullname());
  }
 else {
    viewHolder.nameTextView.setText(data.getName());
  }
  viewHolder.lastMessageTextView.setText(data.getLastMessage());
  viewHolder.userCountTextView.setText(data.getOccupants().size() + Consts.EMPTY_STRING);
  viewHolder.unreadMessagesTextView.setText(data.getUnreadMessageCount() + Consts.EMPTY_STRING);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder viewHolder;
  final QBDialog data=getItem(position);
  if (convertView == null) {
    convertView=layoutInflater.inflate(R.layout.list_item_chat,null);
    viewHolder=createViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
 else {
    viewHolder=(ViewHolder)convertView.getTag();
  }
  if (data.getType() == QBDialogType.PRIVATE) {
    int occupantId=ChatUtils.getOccupantsIdsFromDialog(data).get(Consts.ZERO_VALUE);
    Friend occupant=getOccupantById(occupantId);
    viewHolder.nameTextView.setText(occupant.getFullname());
    viewHolder.userCountTextView.setVisibility(View.GONE);
  }
 else {
    viewHolder.nameTextView.setText(data.getName());
    viewHolder.userCountTextView.setVisibility(View.VISIBLE);
    viewHolder.userCountTextView.setText(data.getOccupants().size() + Consts.EMPTY_STRING);
  }
  viewHolder.lastMessageTextView.setText(data.getLastMessage());
  viewHolder.unreadMessagesTextView.setText(data.getUnreadMessageCount() + Consts.EMPTY_STRING);
  return convertView;
}
Program: 114674
Project: 114674
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder holder;
  final String data=getItem(position);
  if (convertView == null) {
    convertView=layoutInflater.inflate(R.layout.list_item_navigation_drawer,null);
    holder=new ViewHolder();
    holder.nameTextView=(TextView)convertView.findViewById(R.id.name_textview);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.nameTextView.setText(data);
  Resources res=baseActivity.getResources();
  final TransitionDrawable transition=(TransitionDrawable)res.getDrawable(R.drawable.menu_item_background_longclick_transition);
  convertView.setOnTouchListener(new View.OnTouchListener(){
    public boolean onTouch(    View view,    MotionEvent motionEvent){
      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
        transition.startTransition(Consts.DELAY_LONG_CLICK_ANIMATION_LONG);
        view.setBackgroundDrawable(transition);
      }
      return false;
    }
  }
);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder holder;
  final String data=getItem(position);
  if (convertView == null) {
    convertView=layoutInflater.inflate(R.layout.list_item_navigation_drawer,null);
    holder=new ViewHolder();
    holder.nameTextView=(TextView)convertView.findViewById(R.id.name_textview);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.nameTextView.setText(data);
  return convertView;
}
Program: 114675
Project: 114675
Buggy source:
private void initUI(View rootView){
  drawerListView=(ListView)rootView.findViewById(R.id.navigationList);
  logoutButton=(ImageButton)rootView.findViewById(R.id.logoutImageButton);
  fullnameTextView=(TextView)rootView.findViewById(R.id.fullnameTextView);
}

Fixed version (ground truth):
private void initUI(View rootView){
  drawerListView=(ListView)rootView.findViewById(R.id.navigation_listview);
  logoutButton=(ImageButton)rootView.findViewById(R.id.logout_imagebutton);
  fullnameTextView=(TextView)rootView.findViewById(R.id.fullname_textview);
}
Program: 114676
Project: 114676
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,final View view,final int position,long id){
  performItemClick(view,position);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,final View view,final int position,long id){
  selectItem(position);
}
Program: 114677
Project: 114677
Buggy source:
private void initListeners(){
  drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    final View view,    final int position,    long id){
      performItemClick(view,position);
    }
  }
);
  logoutButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      logout();
    }
  }
);
}

Fixed version (ground truth):
private void initListeners(){
  drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    final View view,    final int position,    long id){
      selectItem(position);
    }
  }
);
  logoutButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      logout();
    }
  }
);
}
Program: 114678
Project: 114678
Buggy source:
public BaseListAdapter(BaseActivity baseActivity,List<T> objectsList){
  this.baseActivity=baseActivity;
  this.objectsList=objectsList;
  this.layoutInflater=LayoutInflater.from(baseActivity);
}

Fixed version (ground truth):
public BaseListAdapter(BaseActivity baseActivity,List<T> objectsList){
  this.baseActivity=baseActivity;
  this.objectsList=objectsList;
  this.layoutInflater=LayoutInflater.from(baseActivity);
  resources=baseActivity.getResources();
}
Program: 114679
Project: 114679
Buggy source:
@Override public void onLoadingComplete(String imageUri,View view,final Bitmap loadedImageBitmap){
  progressBar.setVisibility(View.GONE);
  pleaseWaitTextView.setVisibility(View.GONE);
  attachImageView.setVisibility(View.VISIBLE);
  attachImageView.setImageBitmap(loadedImageBitmap);
  attachImageView.setOnClickListener(receiveImageFileOnClickListener());
}

Fixed version (ground truth):
@Override public void onLoadingComplete(String imageUri,View view,final Bitmap loadedImageBitmap){
  progressBar.setVisibility(View.GONE);
  pleaseWaitTextView.setVisibility(View.GONE);
  attachImageView.setVisibility(View.VISIBLE);
  attachImageView.setImageBitmap(loadedImageBitmap);
  attachImageView.setOnClickListener(receiveImageFileOnClickListener());
  this.loadedImageBitmap=loadedImageBitmap;
}
Program: 114680
Project: 114680
Buggy source:
public void onClick(View v){
  CheckBox cb=(CheckBox)v;
  InviteFriend inviteFriend=(InviteFriend)cb.getTag();
  inviteFriend.setSelected(cb.isChecked());
  notifyCounterChanged(cb.isChecked(),inviteFriend.getViaLabelType());
}

Fixed version (ground truth):
public void onClick(View view){
  CheckBox checkBox=(CheckBox)view;
  InviteFriend inviteFriend=(InviteFriend)checkBox.getTag();
  inviteFriend.setSelected(checkBox.isChecked());
  notifyCounterChanged(checkBox.isChecked(),inviteFriend.getViaLabelType());
  finalHolder.contentRelativeLayout.setBackgroundColor(getBackgroundColorItem(checkBox.isChecked()));
}
Program: 114682
Project: 114682
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (resultCode == RESULT_OK) {
    Uri originalUri=data.getData();
    try {
      ParcelFileDescriptor descriptor=getContentResolver().openFileDescriptor(originalUri,"String_Node_Str");
      new GetImageFileTask(PrivateChatActivity.this).execute(imageHelper,BitmapFactory.decodeFileDescriptor(descriptor.getFileDescriptor()),true);
    }
 catch (    FileNotFoundException e) {
      e.printStackTrace();
    }
  }
  super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (resultCode == RESULT_OK) {
    Uri originalUri=data.getData();
    try {
      ParcelFileDescriptor descriptor=getContentResolver().openFileDescriptor(originalUri,"String_Node_Str");
      new ReceiveImageFileTask(PrivateChatActivity.this).execute(imageHelper,BitmapFactory.decodeFileDescriptor(descriptor.getFileDescriptor()),true);
    }
 catch (    FileNotFoundException e) {
      e.printStackTrace();
    }
  }
  super.onActivityResult(requestCode,resultCode,data);
}
Program: 114683
Project: 114683
Buggy source:
@Override public void onClick(View v){
  new GetImageFileTask(PrivateChatMessagesAdapter.this).execute(imageHelper,loadedImageBitmap,false);
}

Fixed version (ground truth):
@Override public void onClick(View v){
  new ReceiveImageFileTask(PrivateChatMessagesAdapter.this).execute(imageHelper,loadedImageBitmap,false);
}
Program: 114684
Project: 114684
Buggy source:
@Override public void onLoadingComplete(String imageUri,View view,final Bitmap loadedImageBitmap){
  progressBar.setVisibility(View.GONE);
  pleaseWaitTextView.setVisibility(View.GONE);
  attachImageView.setVisibility(View.VISIBLE);
  attachImageView.setImageBitmap(loadedImageBitmap);
  attachImageView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      new GetImageFileTask(PrivateChatMessagesAdapter.this).execute(imageHelper,loadedImageBitmap,false);
    }
  }
);
}

Fixed version (ground truth):
@Override public void onLoadingComplete(String imageUri,View view,final Bitmap loadedImageBitmap){
  progressBar.setVisibility(View.GONE);
  pleaseWaitTextView.setVisibility(View.GONE);
  attachImageView.setVisibility(View.VISIBLE);
  attachImageView.setImageBitmap(loadedImageBitmap);
  attachImageView.setOnClickListener(receiveImageFileOnClickListener());
}
Program: 114685
Project: 114685
Buggy source:
private int getItemViewType(Cursor cursor){
  int senderId=cursor.getInt(cursor.getColumnIndex(ChatMessagesTable.Cols.SENDER_ID));
  if (isOwnMessage(senderId)) {
    return Consts.MESSAGE_TYPE_1;
  }
 else {
    return Consts.MESSAGE_TYPE_2;
  }
}

Fixed version (ground truth):
private int getItemViewType(Cursor cursor){
  int senderId=cursor.getInt(cursor.getColumnIndex(ChatMessagesTable.Cols.SENDER_ID));
  if (isOwnMessage(senderId)) {
    return Consts.LEFT_CHAT_MESSAGE_TYPE_1;
  }
 else {
    return Consts.RIGHT_CHAT_MESSAGE_TYPE_2;
  }
}
Program: 114686
Project: 114686
Buggy source:
@Override public boolean onMenuItemActionCollapse(MenuItem item){
  state=State.FRIENDS_LIST;
  baseActivity.getActionBar().setDisplayShowHomeEnabled(true);
  if (isHideSearchView) {
    isHideSearchView=false;
    friendsListView.removeFooterView(globalSearchLayout);
    friendsListView.removeHeaderView(friendsListViewTitle);
    positionCounter--;
    initFriendsList();
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemActionCollapse(MenuItem item){
  state=State.FRIENDS_LIST;
  baseActivity.getActionBar().setDisplayShowHomeEnabled(true);
  if (isHideSearchView) {
    isHideSearchView=false;
    friendsListAdapter.setSearchCharacters(null);
    friendsListAdapter.setFilterQueryProvider(null);
    friendsListView.removeFooterView(globalSearchLayout);
    friendsListView.removeHeaderView(friendsListViewTitle);
    positionCounter--;
    initFriendsList();
  }
  return true;
}
Program: 114687
Project: 114687
Buggy source:
@Override public boolean onQueryTextChange(String newText){
  constraint=newText;
  if (state == State.FRIENDS_LIST) {
    friendsListAdapter.setFilterQueryProvider(this);
    friendsListAdapter.getFilter().filter(newText);
    friendsListAdapter.setSearchCharacters(newText);
  }
 else {
    startUsersListLoader(newText);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onQueryTextChange(String newText){
  constraint=newText;
  friendsListAdapter.setFilterQueryProvider(this);
  if (state == State.FRIENDS_LIST && isHideSearchView) {
    friendsListAdapter.getFilter().filter(newText);
    friendsListAdapter.setSearchCharacters(newText);
  }
 else   if (state == State.GLOBAL_LIST) {
    startUsersListLoader(newText);
  }
  return true;
}
Program: 114688
Project: 114688
Buggy source:
private void saveChanges(final String fullname,final String email) throws IOException {
  if (!isUserDataCorrect()) {
    DialogUtils.showLong(this,getString(R.string.dlg_not_all_fields_entered));
    return;
  }
  if (isUserDataChanges(fullname,email)) {
    showProgress();
    qbUser.setFullName(fullname);
    qbUser.setEmail(email);
    if (isNeedUpdateAvatar) {
      new GetImageFileTask(this).execute(imageHelper,avatarBitmapCurrent,true);
    }
 else {
      QBUpdateUserCommand.start(this,qbUser,null);
    }
  }
}

Fixed version (ground truth):
private void saveChanges(final String fullname,final String email) throws IOException {
  if (!isUserDataCorrect()) {
    DialogUtils.showLong(this,getString(R.string.dlg_not_all_fields_entered));
    return;
  }
  if (isUserDataChanges(fullname,email)) {
    showProgress();
    qbUser.setFullName(fullname);
    qbUser.setEmail(email);
    if (isNeedUpdateAvatar) {
      new ReceiveImageFileTask(this).execute(imageHelper,avatarBitmapCurrent,true);
    }
 else {
      QBUpdateUserCommand.start(this,qbUser,null);
    }
  }
}
Program: 114689
Project: 114689
Buggy source:
public void signUpOnClickListener(View view){
  String fullNameText=fullnameEditText.getText().toString();
  String emailText=emailEditText.getText().toString();
  String passwordText=passwordEditText.getText().toString();
  boolean isFullNameEntered=!TextUtils.isEmpty(fullNameText);
  boolean isEmailEntered=!TextUtils.isEmpty(emailText);
  boolean isPasswordEntered=!TextUtils.isEmpty(passwordText);
  if (isFullNameEntered && isEmailEntered && isPasswordEntered) {
    qbUser.setFullName(fullNameText);
    qbUser.setEmail(emailText);
    qbUser.setPassword(passwordText);
    showProgress();
    if (isNeedUpdateAvatar) {
      new GetImageFileTask(this).execute(imageHelper,avatarBitmapCurrent,true);
    }
 else {
      QBSignUpCommand.start(SignUpActivity.this,qbUser,null);
    }
  }
 else {
    DialogUtils.show(SignUpActivity.this,getString(R.string.dlg_not_all_fields_entered));
  }
}

Fixed version (ground truth):
public void signUpOnClickListener(View view){
  String fullNameText=fullnameEditText.getText().toString();
  String emailText=emailEditText.getText().toString();
  String passwordText=passwordEditText.getText().toString();
  boolean isFullNameEntered=!TextUtils.isEmpty(fullNameText);
  boolean isEmailEntered=!TextUtils.isEmpty(emailText);
  boolean isPasswordEntered=!TextUtils.isEmpty(passwordText);
  if (isFullNameEntered && isEmailEntered && isPasswordEntered) {
    qbUser.setFullName(fullNameText);
    qbUser.setEmail(emailText);
    qbUser.setPassword(passwordText);
    showProgress();
    if (isNeedUpdateAvatar) {
      new ReceiveImageFileTask(this).execute(imageHelper,avatarBitmapCurrent,true);
    }
 else {
      QBSignUpCommand.start(SignUpActivity.this,qbUser,null);
    }
  }
 else {
    DialogUtils.show(SignUpActivity.this,getString(R.string.dlg_not_all_fields_entered));
  }
}
Program: 114690
Project: 114690
Buggy source:
public String getAbsolutePathByBitmap(Bitmap origBitmap){
  File tempFile=new File(activity.getExternalFilesDir(null),"String_Node_Str");
  try {
    Bitmap bitmap=resizeBitmap(origBitmap,origBitmap.getWidth(),origBitmap.getHeight());
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.PNG,0,bos);
    byte[] bitmapData=bos.toByteArray();
    FileOutputStream fos=new FileOutputStream(tempFile);
    fos.write(bitmapData);
    fos.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return tempFile.getAbsolutePath();
}

Fixed version (ground truth):
public String getAbsolutePathByBitmap(Bitmap origBitmap){
  File tempFile=new File(activity.getExternalFilesDir(null),"String_Node_Str");
  ByteArrayOutputStream bos=null;
  FileOutputStream fos=null;
  try {
    Bitmap bitmap=resizeBitmap(origBitmap,origBitmap.getWidth(),origBitmap.getHeight());
    bos=new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.PNG,Consts.ZERO_VALUE,bos);
    byte[] bitmapData=bos.toByteArray();
    fos=new FileOutputStream(tempFile);
    fos.write(bitmapData);
    fos.close();
    bos.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    Utils.closeOutputStream(fos);
    Utils.closeOutputStream(bos);
  }
  return tempFile.getAbsolutePath();
}
Program: 114691
Project: 114691
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_search:
    friendsListView.addFooterView(globalSearchLayout);
  friendsTitle.setText(R.string.frl_friends);
friendsListView.addHeaderView(friendsListViewTitle);
positionCounter++;
return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_search:
    friendsTitle.setText(R.string.frl_friends);
  positionCounter++;
friendsListView.setAdapter(null);
friendsListView.addHeaderView(friendsListViewTitle);
friendsListView.addFooterView(globalSearchLayout);
friendsListView.setAdapter(friendsListAdapter);
return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 114692
Project: 114692
Buggy source:
@Override public boolean onQueryTextChange(String newText){
  constraint=newText;
  if (state == State.FRIENDS_LIST) {
    FriendsListCursorAdapter friendListCursorAdapter=(FriendsListCursorAdapter)friendsListAdapter;
    friendListCursorAdapter.setFilterQueryProvider(this);
    friendListCursorAdapter.getFilter().filter(newText);
    friendListCursorAdapter.setSearchCharacters(newText);
  }
 else {
    startUsersListLoader(newText);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onQueryTextChange(String newText){
  constraint=newText;
  if (state == State.FRIENDS_LIST) {
    friendsListAdapter.setFilterQueryProvider(this);
    friendsListAdapter.getFilter().filter(newText);
    friendsListAdapter.setSearchCharacters(newText);
  }
 else {
    startUsersListLoader(newText);
  }
  return true;
}
Program: 114693
Project: 114693
Buggy source:
@Override public void onDetach(){
  super.onDetach();
  callbacks=null;
}

Fixed version (ground truth):
@Override public void onDetach(){
  super.onDetach();
  navigationDrawerCallbacks=null;
}
Program: 114694
Project: 114694
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  callbacks=(NavigationDrawerCallbacks)activity;
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  navigationDrawerCallbacks=(NavigationDrawerCallbacks)activity;
}