nus-yam/ex-repair huggingface dataset:
Program: 114429
Project: 114429
Buggy source:
public BaseDialogMessagesAdapter(Context context,Cursor cursor){
  super(context,cursor,true);
  random=new Random();
  colorsMap=new HashMap<Integer,Integer>();
  imageHelper=new ImageHelper((android.app.Activity)context);
}

Fixed version (ground truth):
public BaseDialogMessagesAdapter(Context context,Cursor cursor){
  super(context,cursor,true);
  random=new Random();
  colorsMap=new HashMap<Integer,Integer>();
  imageUtils=new ImageUtils((android.app.Activity)context);
}
Program: 114430
Project: 114430
Buggy source:
@Override protected void onFileSelected(Uri originalUri){
  try {
    ParcelFileDescriptor descriptor=getContentResolver().openFileDescriptor(originalUri,"String_Node_Str");
    Bitmap bitmap=BitmapFactory.decodeFileDescriptor(descriptor.getFileDescriptor(),null,bitmapOptions);
    new ReceiveImageFileTask(GroupDialogActivity.this).execute(imageHelper,bitmap,true);
  }
 catch (  FileNotFoundException e) {
    ErrorUtils.showError(this,e.getMessage());
  }
}

Fixed version (ground truth):
@Override protected void onFileSelected(Uri originalUri){
  try {
    ParcelFileDescriptor descriptor=getContentResolver().openFileDescriptor(originalUri,"String_Node_Str");
    Bitmap bitmap=BitmapFactory.decodeFileDescriptor(descriptor.getFileDescriptor(),null,bitmapOptions);
    new ReceiveImageFileTask(GroupDialogActivity.this).execute(imageUtils,bitmap,true);
  }
 catch (  FileNotFoundException e) {
    ErrorUtils.showError(this,e.getMessage());
  }
}
Program: 114431
Project: 114431
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);
      startAction();
    }
  }
 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);
      startAction();
    }
  }
 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: 114432
Project: 114432
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_group_dialog_details);
  dialogId=(String)getIntent().getExtras().getSerializable(QBServiceConsts.EXTRA_DIALOG_ID);
  dialogCurrent=DatabaseManager.getDialogByDialogId(this,dialogId);
  groupDialog=new GroupDialog(dialogCurrent);
  imageHelper=new ImageHelper(this);
  initUI();
  initUIWithData();
  addActions();
  startLoadGroupDialog();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_group_dialog_details);
  dialogId=(String)getIntent().getExtras().getSerializable(QBServiceConsts.EXTRA_DIALOG_ID);
  dialogCurrent=DatabaseManager.getDialogByDialogId(this,dialogId);
  groupDialog=new GroupDialog(dialogCurrent);
  imageUtils=new ImageUtils(this);
  initUI();
  initUIWithData();
  addActions();
  startLoadGroupDialog();
}
Program: 114433
Project: 114433
Buggy source:
public void changeAvatarOnClick(View view){
  canPerformLogout.set(false);
  imageHelper.getImage();
}

Fixed version (ground truth):
public void changeAvatarOnClick(View view){
  canPerformLogout.set(false);
  imageUtils.getImage();
}
Program: 114434
Project: 114434
Buggy source:
private void saveChanges(){
  if (!isUserDataCorrect()) {
    DialogUtils.showLong(this,getString(R.string.gdd_name_not_entered));
    return;
  }
  dialogCurrent.setName(groupNameCurrent);
  if (isNeedUpdateAvatar) {
    new ReceiveImageFileTask(this).execute(imageHelper,avatarBitmapCurrent,true);
  }
 else {
    startUpdatingGroupDialog(null);
  }
  showProgress();
}

Fixed version (ground truth):
private void saveChanges(){
  if (!isUserDataCorrect()) {
    DialogUtils.showLong(this,getString(R.string.gdd_name_not_entered));
    return;
  }
  dialogCurrent.setName(groupNameCurrent);
  if (isNeedUpdateAvatar) {
    new ReceiveImageFileTask(this).execute(imageUtils,avatarBitmapCurrent,true);
  }
 else {
    startUpdatingGroupDialog(null);
  }
  showProgress();
}
Program: 114435
Project: 114435
Buggy source:
@Override protected void onFileSelected(Uri originalUri){
  try {
    ParcelFileDescriptor descriptor=getContentResolver().openFileDescriptor(originalUri,"String_Node_Str");
    Bitmap bitmap=BitmapFactory.decodeFileDescriptor(descriptor.getFileDescriptor(),null,bitmapOptions);
    new ReceiveImageFileTask(PrivateDialogActivity.this).execute(imageHelper,bitmap,true);
  }
 catch (  FileNotFoundException e) {
    ErrorUtils.showError(this,e.getMessage());
  }
}

Fixed version (ground truth):
@Override protected void onFileSelected(Uri originalUri){
  try {
    ParcelFileDescriptor descriptor=getContentResolver().openFileDescriptor(originalUri,"String_Node_Str");
    Bitmap bitmap=BitmapFactory.decodeFileDescriptor(descriptor.getFileDescriptor(),null,bitmapOptions);
    new ReceiveImageFileTask(PrivateDialogActivity.this).execute(imageUtils,bitmap,true);
  }
 catch (  FileNotFoundException e) {
    ErrorUtils.showError(this,e.getMessage());
  }
}
Program: 114436
Project: 114436
Buggy source:
private void initFields(){
  imageHelper=new ImageHelper(this);
  croppedImageBitmap=null;
  Uri originalUri=getIntent().getParcelableExtra(QBServiceConsts.EXTRA_FILE_PATH);
  defaultImageBitmap=imageHelper.getBitmap(originalUri);
  cropImageView.setImageBitmap(defaultImageBitmap);
  cropImageView.setAspectRatio(DEFAULT_ASPECT_RATIO_VALUES,DEFAULT_ASPECT_RATIO_VALUES);
}

Fixed version (ground truth):
private void initFields(){
  imageUtils=new ImageUtils(this);
  croppedImageBitmap=null;
  Uri originalUri=getIntent().getParcelableExtra(QBServiceConsts.EXTRA_FILE_PATH);
  defaultImageBitmap=imageUtils.getBitmap(originalUri);
  cropImageView.setImageBitmap(defaultImageBitmap);
  cropImageView.setAspectRatio(DEFAULT_ASPECT_RATIO_VALUES,DEFAULT_ASPECT_RATIO_VALUES);
}
Program: 114437
Project: 114437
Buggy source:
@Override protected byte[] doInBackground(Object[] params){
  byte[] byteArray=ImageHelper.getBytesBitmap(croppedImageBitmap);
  File file;
  try {
    file=imageHelper.createFile(byteArray);
    onCompressedBitmapReceived(file.getAbsolutePath());
  }
 catch (  IOException e) {
    ErrorUtils.logError(e);
  }
  return null;
}

Fixed version (ground truth):
@Override protected Object doInBackground(Object[] params){
  byte[] byteArray=ImageUtils.getBytesBitmap(croppedImageBitmap);
  File file=null;
  try {
    file=imageUtils.createFile(byteArray);
  }
 catch (  IOException e) {
    ErrorUtils.logError(e);
  }
  return file != null ? file.getAbsolutePath() : null;
}
Program: 114438
Project: 114438
Buggy source:
public static void start(Activity activity,Uri originalUri){
  Intent intent=new Intent(activity,ImageCropperActivity.class);
  intent.putExtra(QBServiceConsts.EXTRA_FILE_PATH,originalUri);
  activity.startActivityForResult(intent,ACTIVITY_RESULT_CODE);
}

Fixed version (ground truth):
public static void start(Activity activity,Uri originalUri){
  Intent intent=new Intent(activity,ImageCropperActivity.class);
  intent.putExtra(QBServiceConsts.EXTRA_FILE_PATH,originalUri);
  activity.startActivityForResult(intent,INTENT_RESULT_CODE);
}
Program: 114439
Project: 114439
Buggy source:
public static void updateMessageDeliveryStatus(Context context,String messageId,boolean isDelivered){
  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()) {
    values.put(MessageTable.Cols.IS_DELIVERED,isDelivered);
    resolver.update(MessageTable.CONTENT_URI,values,condition,null);
    cursor.close();
  }
}

Fixed version (ground truth):
public static void updateMessageDeliveryStatus(Context context,String messageId,boolean isDelivered){
  Log.d("String_Node_Str","String_Node_Str" + messageId);
  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()) {
    values.put(MessageTable.Cols.IS_DELIVERED,isDelivered);
    resolver.update(MessageTable.CONTENT_URI,values,condition,null);
    cursor.close();
  }
}
Program: 114440
Project: 114440
Buggy source:
protected void sendMessageDeliveryStatus(String packedId,String messageId,int friendId,int dialogTypeCode){
  QBPrivateChat chat=chatService.getPrivateChatManager().getChat(friendId);
  if (chat == null) {
    chat=chatService.getPrivateChatManager().createChat(friendId,null);
  }
  QBChatMessage chatMessage=ChatUtils.createNotificationMessageForDeliveryStatusRead(context,packedId,messageId,dialogTypeCode);
  try {
    chat.sendMessage(chatMessage);
  }
 catch (  Exception e) {
    ErrorUtils.logError(e);
  }
}

Fixed version (ground truth):
protected void sendMessageDeliveryStatus(String packedId,String messageId,int friendId,int dialogTypeCode){
  QBPrivateChat chat=chatService.getPrivateChatManager().getChat(friendId);
  if (chat == null) {
    chat=chatService.getPrivateChatManager().createChat(friendId,null);
  }
  QBChatMessage chatMessage=ChatUtils.createNotificationMessageForDeliveryStatusRead(context,packedId,messageId,dialogTypeCode);
  Log.d("String_Node_Str","String_Node_Str" + chatMessage.getPacketId() + "String_Node_Str"+ chatMessage.getMessageId());
  try {
    chat.sendMessage(chatMessage);
  }
 catch (  Exception e) {
    ErrorUtils.logError(e);
  }
}
Program: 114441
Project: 114441
Buggy source:
protected void sendPrivateMessage(QBChatMessage chatMessage,int opponentId,String dialogId) throws QBResponseException {
  QBPrivateChat privateChat=privateChatManager.getChat(opponentId);
  if (privateChat == null) {
    throw new QBResponseException("String_Node_Str");
  }
  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_send_msg);
  }
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) {
    throw new QBResponseException("String_Node_Str");
  }
  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_send_msg);
  }
catch (  SmackException.NotConnectedException e) {
    error=context.getString(R.string.dlg_fail_connection);
  }
  if (error != null) {
    throw new QBResponseException(error);
  }
  Log.d("String_Node_Str","String_Node_Str" + chatMessage.getPacketId() + "String_Node_Str"+ chatMessage.getMessageId());
}
Program: 114442
Project: 114442
Buggy source:
private void messageDeliveryStatusReceived(QBChatMessage chatMessage){
  String messageId;
  String dialogTypeCodeString=chatMessage.getProperty(ChatUtils.PROPERTY_DIALOG_TYPE_CODE);
  boolean messageDelivered=true;
  if (QBDialogType.PRIVATE.equals(ChatUtils.parseDialogType(dialogTypeCodeString))) {
    messageId=chatMessage.getPacketId();
  }
 else {
    messageId=chatMessage.getProperty(ChatUtils.PROPERTY_MESSAGE_ID);
  }
  updateMessageStatusDelivered(messageId,messageDelivered);
}

Fixed version (ground truth):
private void messageDeliveryStatusReceived(QBChatMessage chatMessage){
  String messageId;
  boolean messageDelivered=true;
  messageId=chatMessage.getProperty(ChatUtils.PROPERTY_MESSAGE_ID);
  Log.d("String_Node_Str","String_Node_Str" + chatMessage.getPacketId() + "String_Node_Str"+ messageId);
  updateMessageStatusDelivered(messageId,messageDelivered);
}
Program: 114443
Project: 114443
Buggy source:
@Override public void onReceivedNotification(String notificationType,QBChatMessage chatMessage){
  Log.d("String_Node_Str","String_Node_Str" + chatMessage.getPacketId());
  if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_CREATE_CHAT.equals(notificationType)) {
    createDialogByNotification(chatMessage);
  }
 else   if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_MESSAGE_DELIVERY_STATUS.equals(notificationType)) {
    messageDeliveryStatusReceived(chatMessage);
  }
 else {
    updateDialogByNotification(chatMessage);
  }
}

Fixed version (ground truth):
@Override public void onReceivedNotification(String notificationType,QBChatMessage chatMessage){
  if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_CREATE_CHAT.equals(notificationType)) {
    createDialogByNotification(chatMessage);
  }
 else   if (ChatUtils.PROPERTY_NOTIFICATION_TYPE_MESSAGE_DELIVERY_STATUS.equals(notificationType)) {
    messageDeliveryStatusReceived(chatMessage);
  }
 else {
    updateDialogByNotification(chatMessage);
  }
}
Program: 114444
Project: 114444
Buggy source:
@Override protected void onPrivateMessageReceived(QBPrivateChat privateChat,QBChatMessage chatMessage){
  Log.d("String_Node_Str","String_Node_Str" + chatMessage.getPacketId());
  Friend friend=DatabaseManager.getFriendById(context,chatMessage.getSenderId());
  if (friend == null) {
    friend=new Friend();
    friend.setFullname(Consts.EMPTY_STRING + chatMessage.getSenderId());
  }
  String messageId;
  long time;
  String attachUrl;
  messageId=chatMessage.getProperty(ChatUtils.PROPERTY_MESSAGE_ID);
  time=Long.parseLong(chatMessage.getProperty(ChatUtils.PROPERTY_DATE_SENT));
  attachUrl=ChatUtils.getAttachUrlIfExists(chatMessage);
  String dialogId=chatMessage.getProperty(ChatUtils.PROPERTY_DIALOG_ID);
  String packetId=chatMessage.getPacketId();
  saveMessageToCache(new MessageCache(messageId,dialogId,packetId,chatMessage.getSenderId(),chatMessage.getBody(),attachUrl,time,false,false));
  notifyMessageReceived(chatMessage,friend,dialogId);
}

Fixed version (ground truth):
@Override protected void onPrivateMessageReceived(QBPrivateChat privateChat,QBChatMessage chatMessage){
  Friend friend=DatabaseManager.getFriendById(context,chatMessage.getSenderId());
  if (friend == null) {
    friend=new Friend();
    friend.setFullname(Consts.EMPTY_STRING + chatMessage.getSenderId());
  }
  String messageId;
  long time;
  String attachUrl;
  messageId=chatMessage.getProperty(ChatUtils.PROPERTY_MESSAGE_ID);
  time=Long.parseLong(chatMessage.getProperty(ChatUtils.PROPERTY_DATE_SENT));
  attachUrl=ChatUtils.getAttachUrlIfExists(chatMessage);
  String dialogId=chatMessage.getProperty(ChatUtils.PROPERTY_DIALOG_ID);
  String packetId=chatMessage.getPacketId();
  saveMessageToCache(new MessageCache(messageId,dialogId,packetId,chatMessage.getSenderId(),chatMessage.getBody(),attachUrl,time,false,false));
  notifyMessageReceived(chatMessage,friend,dialogId);
  Log.d("String_Node_Str","String_Node_Str" + chatMessage.getPacketId() + "String_Node_Str"+ messageId);
}
Program: 114446
Project: 114446
Buggy source:
@Override public void onDestroyActionMode(ActionMode mode){
  if (!closeActionMode) {
    updateCurrentUserData();
    updateUserData();
  }
  actionMode=null;
}

Fixed version (ground truth):
@Override public void onDestroyActionMode(ActionMode mode){
  if (!closeActionMode) {
    updateUserData();
    updateCurrentUserData();
  }
  actionMode=null;
}
Program: 114447
Project: 114447
Buggy source:
private void initUI(){
  groupNameEditText=_findViewById(R.id.name_textview);
  participantsTextView=_findViewById(R.id.participants_textview);
  friendsListView=_findViewById(R.id.chat_friends_listview);
  onlineParticipantsTextView=_findViewById(R.id.online_participants_textview);
}

Fixed version (ground truth):
private void initUI(){
  avatarImageView=_findViewById(R.id.avatar_imageview);
  avatarImageView.setOval(true);
  groupNameEditText=_findViewById(R.id.name_textview);
  participantsTextView=_findViewById(R.id.participants_textview);
  friendsListView=_findViewById(R.id.chat_friends_listview);
  onlineParticipantsTextView=_findViewById(R.id.online_participants_textview);
}
Program: 114448
Project: 114448
Buggy source:
private boolean isGroupDataChanged(String groupName){
  return !groupName.equals(groupNameOld);
}

Fixed version (ground truth):
private boolean isGroupDataChanged(String groupName){
  return !groupName.equals(groupNameOld) || isNeedUpdateAvatar;
}
Program: 114449
Project: 114449
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_group_dialog_details);
  dialogId=(String)getIntent().getExtras().getSerializable(QBServiceConsts.EXTRA_DIALOG_ID);
  groupDialog=new GroupDialog(DatabaseManager.getDialogByDialogId(this,dialogId));
  initUI();
  initUIWithData();
  addActions();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_group_dialog_details);
  dialogId=(String)getIntent().getExtras().getSerializable(QBServiceConsts.EXTRA_DIALOG_ID);
  groupDialog=new GroupDialog(DatabaseManager.getDialogByDialogId(this,dialogId));
  imageHelper=new ImageHelper(this);
  initUI();
  initUIWithData();
  addActions();
}
Program: 114451
Project: 114451
Buggy source:
@Override public void setText(CharSequence text,BufferType type){
  SpannableStringBuilder builder=new SpannableStringBuilder(text);
  EmojiCreator.addEmojis(getContext(),builder,emojiconSize);
  super.setText(builder,type);
}

Fixed version (ground truth):
@Override public void setText(CharSequence text,BufferType type){
  if (text == null) {
    super.setText(Consts.EMPTY_STRING);
    return;
  }
  SpannableStringBuilder builder=new SpannableStringBuilder(text);
  EmojiCreator.addEmojis(getContext(),builder,emojiconSize);
  super.setText(builder,type);
}
Program: 114452
Project: 114452
Buggy source:
private void initUI(){
  changeAvatarLinearLayout=_findViewById(R.id.change_avatar_linearlayout);
  avatarTextView=_findViewById(R.id.avatar_textview);
  avatarImageView=_findViewById(R.id.avatar_imageview);
  avatarImageView.setOval(true);
  emailLinearLayout=_findViewById(R.id.email_linearlayout);
  changeFullNameRelativeLayout=_findViewById(R.id.change_fullname_relativelayout);
  changePhoneRelativeLayout=_findViewById(R.id.change_phone_relativelayout);
  changeStatusRelativeLayout=_findViewById(R.id.change_status_relativelayout);
  emailTextView=_findViewById(R.id.email_textview);
  fullNameEditText=_findViewById(R.id.fullname_edittext);
  phoneEditText=_findViewById(R.id.phone_edittext);
  statusEditText=_findViewById(R.id.status_edittext);
}

Fixed version (ground truth):
private void initUI(){
  changeAvatarLinearLayout=_findViewById(R.id.change_avatar_linearlayout);
  avatarImageView=_findViewById(R.id.avatar_imageview);
  avatarImageView.setOval(true);
  emailLinearLayout=_findViewById(R.id.email_linearlayout);
  changeFullNameRelativeLayout=_findViewById(R.id.change_fullname_relativelayout);
  changePhoneRelativeLayout=_findViewById(R.id.change_phone_relativelayout);
  changeStatusRelativeLayout=_findViewById(R.id.change_status_relativelayout);
  emailTextView=_findViewById(R.id.email_textview);
  fullNameEditText=_findViewById(R.id.fullname_edittext);
  phoneEditText=_findViewById(R.id.phone_edittext);
  statusEditText=_findViewById(R.id.status_edittext);
}
Program: 114453
Project: 114453
Buggy source:
private void resetUserData(){
  user.setFullName(fullnameOld);
  user.setPhone(phoneOld);
  user.setCustomData(statusOld);
}

Fixed version (ground truth):
private void resetUserData(){
  user.setFullName(fullnameOld);
  user.setPhone(phoneOld);
  user.setCustomData(statusOld);
  isNeedUpdateAvatar=false;
}
Program: 114454
Project: 114454
Buggy source:
private void updateOldUserData(){
  fullnameOld=fullNameEditText.getText().toString();
  phoneOld=phoneEditText.getText().toString();
  statusOld=statusEditText.getText().toString();
}

Fixed version (ground truth):
private void updateOldUserData(){
  fullnameOld=fullNameEditText.getText().toString();
  phoneOld=phoneEditText.getText().toString();
  statusOld=statusEditText.getText().toString();
  isNeedUpdateAvatar=false;
}
Program: 114455
Project: 114455
Buggy source:
public static ImageLoaderConfiguration getImageLoaderConfiguration(Context context){
  final int MEMORY_CACHE_LIMIT=2 * 1024 * 1024;
  final int THREAD_POOL_SIZE=5;
  final int COMPRESS_QUALITY=60;
  final int MAX_IMAGE_WIDTH_FOR_MEMORY_CACHE=300;
  final int MAX_IMAGE_HEIGHT_FOR_MEMORY_CACHE=800;
  ImageLoaderConfiguration imageLoaderConfiguration=new ImageLoaderConfiguration.Builder(context).memoryCacheExtraOptions(MAX_IMAGE_WIDTH_FOR_MEMORY_CACHE,MAX_IMAGE_HEIGHT_FOR_MEMORY_CACHE).discCacheExtraOptions(MAX_IMAGE_WIDTH_FOR_MEMORY_CACHE,MAX_IMAGE_HEIGHT_FOR_MEMORY_CACHE,Bitmap.CompressFormat.JPEG,COMPRESS_QUALITY,null).threadPoolSize(THREAD_POOL_SIZE).threadPriority(Thread.NORM_PRIORITY).denyCacheImageMultipleSizesInMemory().memoryCache(new UsingFreqLimitedMemoryCache(MEMORY_CACHE_LIMIT)).writeDebugLogs().defaultDisplayImageOptions(Consts.UIL_DEFAULT_DISPLAY_OPTIONS).imageDecoder(new SmartUriDecoder(context,new BaseImageDecoder(false))).denyCacheImageMultipleSizesInMemory().discCacheFileNameGenerator(new HashCodeFileNameGeneratorWithoutToken()).build();
  return imageLoaderConfiguration;
}

Fixed version (ground truth):
public static ImageLoaderConfiguration getImageLoaderConfiguration(Context context){
  final int MEMORY_CACHE_LIMIT=2 * 1024 * 1024;
  final int THREAD_POOL_SIZE=5;
  final int COMPRESS_QUALITY=60;
  final int MAX_IMAGE_WIDTH_FOR_MEMORY_CACHE=600;
  final int MAX_IMAGE_HEIGHT_FOR_MEMORY_CACHE=1200;
  ImageLoaderConfiguration imageLoaderConfiguration=new ImageLoaderConfiguration.Builder(context).memoryCacheExtraOptions(MAX_IMAGE_WIDTH_FOR_MEMORY_CACHE,MAX_IMAGE_HEIGHT_FOR_MEMORY_CACHE).discCacheExtraOptions(MAX_IMAGE_WIDTH_FOR_MEMORY_CACHE,MAX_IMAGE_HEIGHT_FOR_MEMORY_CACHE,Bitmap.CompressFormat.JPEG,COMPRESS_QUALITY,null).threadPoolSize(THREAD_POOL_SIZE).threadPriority(Thread.NORM_PRIORITY).denyCacheImageMultipleSizesInMemory().memoryCache(new UsingFreqLimitedMemoryCache(MEMORY_CACHE_LIMIT)).writeDebugLogs().defaultDisplayImageOptions(Consts.UIL_DEFAULT_DISPLAY_OPTIONS).imageDecoder(new SmartUriDecoder(context,new BaseImageDecoder(false))).denyCacheImageMultipleSizesInMemory().discCacheFileNameGenerator(new HashCodeFileNameGeneratorWithoutToken()).build();
  return imageLoaderConfiguration;
}
Program: 114456
Project: 114456
Buggy source:
@Override public void setText(CharSequence text,BufferType type){
  if (TextUtils.isEmpty(text)) {
    super.setText(Consts.EMPTY_STRING);
    return;
  }
  SpannableStringBuilder builder=new SpannableStringBuilder(text);
  EmojiCreator.addEmojis(getContext(),builder,emojiconSize);
  super.setText(builder,type);
}

Fixed version (ground truth):
@Override public void setText(CharSequence text,BufferType type){
  if (text == null) {
    super.setText(Consts.EMPTY_STRING);
    return;
  }
  SpannableStringBuilder builder=new SpannableStringBuilder(text);
  EmojiCreator.addEmojis(getContext(),builder,emojiconSize);
  super.setText(builder,type);
}
Program: 114457
Project: 114457
Buggy source:
public File getFileFromImageView(Bitmap origBitmap) throws IOException {
  int width=SizeUtility.dipToPixels(activity,Consts.CHAT_ATTACH_WIDTH);
  int origWidth=origBitmap.getWidth();
  int origHeight=origBitmap.getHeight();
  File tempFile=new File(activity.getCacheDir(),TEMP_FILE_NAME);
  tempFile.createNewFile();
  Bitmap bitmap=getScaledBitmap(origBitmap,origWidth,origHeight,width);
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  bitmap.compress(Bitmap.CompressFormat.PNG,Consts.FULL_QUALITY,bos);
  byte[] bitmapData=bos.toByteArray();
  FileOutputStream fos=new FileOutputStream(tempFile);
  fos.write(bitmapData);
  fos.close();
  bos.close();
  return tempFile;
}

Fixed version (ground truth):
public File getFileFromImageView(Bitmap origBitmap) throws IOException {
  int width=SizeUtility.dipToPixels(activity,Consts.CHAT_ATTACH_WIDTH);
  File tempFile=new File(activity.getCacheDir(),TEMP_FILE_NAME);
  tempFile.createNewFile();
  Bitmap bitmap=getBitmap(origBitmap,width,width);
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  bitmap.compress(Bitmap.CompressFormat.PNG,Consts.FULL_QUALITY,bos);
  byte[] bitmapData=bos.toByteArray();
  FileOutputStream fos=new FileOutputStream(tempFile);
  fos.write(bitmapData);
  fos.close();
  bos.close();
  return tempFile;
}
Program: 114458
Project: 114458
Buggy source:
public Bitmap generateMask(Bitmap mask,Bitmap original){
  int width=SizeUtility.dipToPixels(activity,Consts.CHAT_ATTACH_WIDTH);
  original=getScaledBitmap(original,original.getWidth(),original.getHeight(),width);
  Bitmap result=Bitmap.createBitmap(width,original.getHeight(),Bitmap.Config.ARGB_8888);
  mask=getNinepatch(resources,mask,width,original.getHeight());
  Canvas canvas=new Canvas(result);
  Paint paint=new Paint(Paint.ANTI_ALIAS_FLAG);
  paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
  canvas.drawBitmap(original,Consts.ZERO_INT_VALUE,Consts.ZERO_INT_VALUE,null);
  canvas.drawBitmap(mask,Consts.ZERO_INT_VALUE,Consts.ZERO_INT_VALUE,paint);
  paint.setXfermode(null);
  return result;
}

Fixed version (ground truth):
public Bitmap generateMask(Bitmap mask,Bitmap original){
  int width=SizeUtility.dipToPixels(activity,Consts.CHAT_ATTACH_WIDTH);
  original=getBitmap(original,width,width);
  Bitmap result=Bitmap.createBitmap(width,original.getHeight(),Bitmap.Config.ARGB_8888);
  mask=getNinepatch(resources,mask,width,original.getHeight());
  Canvas canvas=new Canvas(result);
  Paint paint=new Paint(Paint.ANTI_ALIAS_FLAG);
  paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
  canvas.drawBitmap(original,Consts.ZERO_INT_VALUE,Consts.ZERO_INT_VALUE,null);
  canvas.drawBitmap(mask,Consts.ZERO_INT_VALUE,Consts.ZERO_INT_VALUE,paint);
  paint.setXfermode(null);
  return result;
}
Program: 114459
Project: 114459
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_friend_details);
  canPerformLogout.set(true);
  int friendId=getIntent().getExtras().getInt(QBServiceConsts.EXTRA_FRIEND_ID);
  friendCursor=DatabaseManager.getFriendCursorById(this,friendId);
  friend=DatabaseManager.getFriendById(this,friendId);
  initUI();
  initListeners();
  initUIWithFriendsData();
  initBroadcastActionList();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_friend_details);
  canPerformLogout.set(true);
  int friendId=getIntent().getExtras().getInt(QBServiceConsts.EXTRA_FRIEND_ID);
  friendCursor=DatabaseManager.getFriendCursorById(this,friendId);
  friend=DatabaseManager.getFriendById(this,friendId);
  initUI();
  registerStatusChangingObserver();
  initUIWithFriendsData();
  initBroadcastActionList();
}
Program: 114460
Project: 114460
Buggy source:
@Override public void onCounterFriendsChanged(int valueCounter){
  if (actionMode != null) {
    if (valueCounter == Consts.ZERO_INT_VALUE) {
      closeActionModeWithRedirect(true);
      return;
    }
  }
 else {
    startAction();
  }
  countSelectedFriendsTextView.setText(valueCounter + Consts.EMPTY_STRING);
}

Fixed version (ground truth):
@Override public void onCounterFriendsChanged(int valueCounter){
  if (actionMode != null) {
    if (valueCounter == Consts.ZERO_INT_VALUE) {
      closeActionModeWithRedirect(true);
      return;
    }
  }
 else {
    startAction();
  }
  actionMode.setTitle(getResources().getString(R.string.ndl_ac_mode_title) + Consts.SPACE + valueCounter);
}
Program: 114461
Project: 114461
Buggy source:
private void startAction(){
  actionMode=startActionMode(new ActionModeCallback());
  View view=getLayoutInflater().inflate(getActionModeLayoutId(),null);
  countSelectedFriendsTextView=(TextView)view.findViewById(R.id.count_selected_friends_textview);
  actionMode.setCustomView(view);
}

Fixed version (ground truth):
private void startAction(){
  actionMode=startActionMode(new ActionModeCallback());
}
Program: 114462
Project: 114462
Buggy source:
public DialogsSelectableFriendsAdapter(Context context,Cursor cursor){
  super(context,cursor,true);
  selectedFriends=new ArrayList<Friend>();
  layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

Fixed version (ground truth):
public DialogsSelectableFriendsAdapter(Context context,Cursor cursor){
  super(context,cursor,true);
  selectedFriends=new ArrayList<Friend>();
  layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  sparseArrayCheckBoxes=new HashMap<Integer,Boolean>();
}
Program: 114463
Project: 114463
Buggy source:
@Override public void bindView(View view,Context context,Cursor cursor){
  final ViewHolder viewHolder=(ViewHolder)view.getTag();
  Friend friend=DatabaseManager.getFriendFromCursor(cursor);
  viewHolder.nameTextView.setText(friend.getFullname());
  viewHolder.statusMessageTextView.setText(friend.getStatus());
  viewHolder.nameTextView.setText(friend.getFullname());
  viewHolder.selectFriendCheckBox.setChecked(friend.isSelected());
  viewHolder.selectFriendCheckBox.setTag(friend);
  if (friend.isOnline()) {
    viewHolder.onlineImageView.setVisibility(View.VISIBLE);
  }
 else {
    viewHolder.onlineImageView.setVisibility(View.GONE);
  }
  viewHolder.selectFriendCheckBox.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      CheckBox checkBox=(CheckBox)view;
      Friend friend=(Friend)checkBox.getTag();
      friend.setSelected(checkBox.isChecked());
      notifyCounterChanged(checkBox.isChecked());
      if (checkBox.isChecked()) {
        selectedFriends.add(friend);
      }
 else       if (selectedFriends.contains(friend)) {
        selectedFriends.remove(friend);
      }
      viewHolder.contentRelativeLayout.setBackgroundColor(getBackgroundColorItem(viewHolder.selectFriendCheckBox.isChecked()));
    }
  }
);
  String avatarUrl=getAvatarUrlForFriend(friend);
  displayAvatarImage(avatarUrl,viewHolder.avatarImageView);
  viewHolder.contentRelativeLayout.setBackgroundColor(getBackgroundColorItem(viewHolder.selectFriendCheckBox.isChecked()));
}

Fixed version (ground truth):
@Override public void bindView(View view,Context context,final Cursor cursor){
  final ViewHolder viewHolder=(ViewHolder)view.getTag();
  final Friend friend=DatabaseManager.getFriendFromCursor(cursor);
  viewHolder.nameTextView.setText(friend.getFullname());
  viewHolder.statusMessageTextView.setText(friend.getStatus());
  viewHolder.nameTextView.setText(friend.getFullname());
  if (friend.isOnline()) {
    viewHolder.onlineImageView.setVisibility(View.VISIBLE);
  }
 else {
    viewHolder.onlineImageView.setVisibility(View.GONE);
  }
  final int position=cursor.getPosition();
  viewHolder.selectFriendCheckBox.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      CheckBox checkBox=(CheckBox)view;
      sparseArrayCheckBoxes.put(position,checkBox.isChecked());
      friend.setSelected(checkBox.isChecked());
      notifyCounterChanged(checkBox.isChecked());
      if (checkBox.isChecked()) {
        selectedFriends.add(friend);
      }
 else       if (selectedFriends.contains(friend)) {
        selectedFriends.remove(friend);
      }
      viewHolder.contentRelativeLayout.setBackgroundColor(getBackgroundColorItem(viewHolder.selectFriendCheckBox.isChecked()));
    }
  }
);
  boolean checked=sparseArrayCheckBoxes.get(position) == null ? false : sparseArrayCheckBoxes.get(position);
  viewHolder.selectFriendCheckBox.setChecked(checked);
  String avatarUrl=getAvatarUrlForFriend(friend);
  displayAvatarImage(avatarUrl,viewHolder.avatarImageView);
  viewHolder.contentRelativeLayout.setBackgroundColor(getBackgroundColorItem(checked));
}
Program: 114464
Project: 114464
Buggy source:
public void onClick(View view){
  CheckBox checkBox=(CheckBox)view;
  Friend friend=(Friend)checkBox.getTag();
  friend.setSelected(checkBox.isChecked());
  notifyCounterChanged(checkBox.isChecked());
  if (checkBox.isChecked()) {
    selectedFriends.add(friend);
  }
 else   if (selectedFriends.contains(friend)) {
    selectedFriends.remove(friend);
  }
  viewHolder.contentRelativeLayout.setBackgroundColor(getBackgroundColorItem(viewHolder.selectFriendCheckBox.isChecked()));
}

Fixed version (ground truth):
public void onClick(View view){
  CheckBox checkBox=(CheckBox)view;
  sparseArrayCheckBoxes.put(position,checkBox.isChecked());
  friend.setSelected(checkBox.isChecked());
  notifyCounterChanged(checkBox.isChecked());
  if (checkBox.isChecked()) {
    selectedFriends.add(friend);
  }
 else   if (selectedFriends.contains(friend)) {
    selectedFriends.remove(friend);
  }
  viewHolder.contentRelativeLayout.setBackgroundColor(getBackgroundColorItem(viewHolder.selectFriendCheckBox.isChecked()));
}
Program: 114465
Project: 114465
Buggy source:
private void hideSmileLayout(){
  hideView(smilesLayout);
  chatEditText.switchSmileIcon();
}

Fixed version (ground truth):
private void hideSmileLayout(){
  hideView(smilesLayout);
  prepareChatEditText(true);
}
Program: 114466
Project: 114466
Buggy source:
@Override public void onSmileClick(){
  int smilesLayoutHeight=getSmileLayoutSizeInPixels();
  if (isSmilesLayoutShowing()) {
    smilesAnimator.animateHeightFrom(smilesLayoutHeight,Consts.ZERO_INT_VALUE);
  }
 else {
    smilesAnimator.animateHeightFrom(Consts.ZERO_INT_VALUE,smilesLayoutHeight);
  }
}

Fixed version (ground truth):
@Override public void onSmileClick(){
  if (isSmilesLayoutShowing()) {
    hideSmileLayout();
  }
 else {
    KeyboardUtils.hideKeyboard(BaseDialogActivity.this);
    showSmileLayout();
  }
}
Program: 114467
Project: 114467
Buggy source:
public void initSmileWidgets(){
  chatEditText.setSmileClickListener(new OnSmileClickListener());
  chatEditText.setSwitchViewListener(this);
  FragmentStatePagerAdapter adapter=new SmilesTabFragmentAdapter(getSupportFragmentManager());
  smilesViewPager.setAdapter(adapter);
  smilesViewPager.setOffscreenPageLimit(1);
  smilesPagerIndicator.setViewPager(smilesViewPager);
  smilesAnimator=new HeightAnimator(chatEditText,smilesLayout);
}

Fixed version (ground truth):
public void initSmileWidgets(){
  chatEditText.setSmileClickListener(new OnSmileClickListener());
  chatEditText.setSwitchViewListener(this);
  FragmentStatePagerAdapter adapter=new SmilesTabFragmentAdapter(getSupportFragmentManager());
  smilesViewPager.setAdapter(adapter);
  smilesPagerIndicator.setViewPager(smilesViewPager);
}
Program: 114468
Project: 114468
Buggy source:
@Override public boolean onTouch(View v,MotionEvent event){
  if (event.getAction() != MotionEvent.ACTION_UP) {
    return false;
  }
  if (event.getX() > (getWidth() - getPaddingRight() - smileIcon.getIntrinsicWidth()) && smileClickListener != null) {
    switchSmileIcon();
    smileClickListener.onSmileClick();
  }
 else   if (switchViewListener != null) {
    switchViewListener.showLastListItem();
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onTouch(View v,MotionEvent event){
  if (event.getAction() != MotionEvent.ACTION_UP) {
    return false;
  }
  if (event.getX() > (getWidth() - getPaddingRight() - smileIcon.getIntrinsicWidth()) && smileClickListener != null) {
    smileClickListener.onSmileClick();
    return true;
  }
 else   if (switchViewListener != null) {
    switchViewListener.showLastListItem();
  }
  return false;
}
Program: 114469
Project: 114469
Buggy source:
private List<Integer> getSelectedUsersList(List<QBUser> realFriendsFacebookList,List<QBUser> realFriendsContactsList){
  List<Integer> userIdsList=new ArrayList<Integer>();
  if (!realFriendsFacebookList.isEmpty()) {
    userIdsList.addAll(FriendUtils.getFriendIdsList(realFriendsFacebookList));
  }
  if (!realFriendsContactsList.isEmpty()) {
    userIdsList.addAll(FriendUtils.getFriendIdsList(realFriendsContactsList));
  }
  return userIdsList;
}

Fixed version (ground truth):
private List<Integer> getSelectedUsersList(List<QBUser> realFriendsFacebookList,List<QBUser> realFriendsContactsList){
  List<Integer> userIdsList=new ArrayList<Integer>();
  if (realFriendsFacebookList != null && !realFriendsFacebookList.isEmpty()) {
    userIdsList.addAll(FriendUtils.getFriendIdsList(realFriendsFacebookList));
  }
  if (realFriendsContactsList != null && !realFriendsContactsList.isEmpty()) {
    userIdsList.addAll(FriendUtils.getFriendIdsList(realFriendsContactsList));
  }
  return userIdsList;
}
Program: 114471
Project: 114471
Buggy source:
public static void start(Context context,List<QBDialog> roomJidList){
  Intent intent=new Intent(QBServiceConsts.JOIN_GROUP_CHAT_ACTION,null,context,QBService.class);
  intent.putExtra(QBServiceConsts.EXTRA_ROOM_JID_LIST,new ArrayList<QBDialog>(roomJidList));
  context.startService(intent);
}

Fixed version (ground truth):
public static void start(Context context,ArrayList<QBDialog> dialogList){
  Intent intent=new Intent(QBServiceConsts.JOIN_GROUP_CHAT_ACTION,null,context,QBService.class);
  intent.putExtra(QBServiceConsts.EXTRA_ROOM_JID_LIST,dialogList);
  context.startService(intent);
}
Program: 114472
Project: 114472
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_change_password);
  resources=getResources();
  canPerformLogout.set(false);
  initUI();
  addActions();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_change_password);
  resources=getResources();
  canPerformLogout.set(false);
  initUI();
  addActions();
  user=AppSession.getSession().getUser();
}
Program: 114473
Project: 114473
Buggy source:
public void changePasswordOnClickListener(View view){
  String oldPasswordText=oldPasswordEditText.getText().toString();
  String newPasswordText=newPasswordEditText.getText().toString();
  if (validationUtils.isValidChangePasswordData(oldPasswordText,newPasswordText)) {
    QBUser user=AppSession.getSession().getUser();
    user.setOldPassword(oldPasswordText);
    user.setPassword(newPasswordText);
    showProgress();
    QBChangePasswordCommand.start(this,user);
  }
}

Fixed version (ground truth):
public void changePasswordOnClickListener(View view){
  oldPasswordText=oldPasswordEditText.getText().toString();
  newPasswordText=newPasswordEditText.getText().toString();
  if (validationUtils.isValidChangePasswordData(oldPasswordText,newPasswordText)) {
    updatePasswords(oldPasswordText,newPasswordText);
    showProgress();
    QBChangePasswordCommand.start(this,user);
  }
}
Program: 114474
Project: 114474
Buggy source:
private void addActions(){
  addAction(QBServiceConsts.CHANGE_PASSWORD_SUCCESS_ACTION,new ChangePasswordSuccessAction());
  addAction(QBServiceConsts.CHANGE_PASSWORD_FAIL_ACTION,failAction);
  updateBroadcastActionList();
}

Fixed version (ground truth):
private void addActions(){
  addAction(QBServiceConsts.CHANGE_PASSWORD_SUCCESS_ACTION,new ChangePasswordSuccessAction());
  addAction(QBServiceConsts.CHANGE_PASSWORD_FAIL_ACTION,new ChangePasswordFailAction());
  updateBroadcastActionList();
}
Program: 114475
Project: 114475
Buggy source:
@Override public void execute(Bundle bundle){
  QBUser user=(QBUser)bundle.getSerializable(QBServiceConsts.EXTRA_USER);
  saveUserCredentials(user);
  hideProgress();
  clearFields();
  DialogUtils.showLong(ChangePasswordActivity.this,getString(R.string.dlg_password_changed));
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  Exception exception=(Exception)bundle.getSerializable(QBServiceConsts.EXTRA_ERROR);
  hideProgress();
  DialogUtils.showLong(ChangePasswordActivity.this,exception.getMessage());
  updatePasswords(oldPasswordText,oldPasswordText);
  clearFields();
}
Program: 114476
Project: 114476
Buggy source:
@Override public void onCounterFriendsChanged(int valueCounter){
  if (actionMode != null) {
    if (valueCounter == Consts.ZERO_INT_VALUE) {
      isNeedToCloseWithoutRedirect=true;
      actionMode.finish();
      return;
    }
  }
 else {
    startAction();
  }
  countSelectedFriendsTextView.setText(valueCounter + Consts.EMPTY_STRING);
}

Fixed version (ground truth):
@Override public void onCounterFriendsChanged(int valueCounter){
  if (actionMode != null) {
    if (valueCounter == Consts.ZERO_INT_VALUE) {
      closeActionModeWithRedirect(true);
      return;
    }
  }
 else {
    startAction();
  }
  countSelectedFriendsTextView.setText(valueCounter + Consts.EMPTY_STRING);
}
Program: 114477
Project: 114477
Buggy source:
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (actionMode != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
    isNeedToCloseWithoutRedirect=true;
    actionMode.finish();
    return true;
  }
 else {
    isNeedToCloseWithoutRedirect=false;
  }
  return super.dispatchKeyEvent(event);
}

Fixed version (ground truth):
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (actionMode != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
    closeActionModeWithRedirect(true);
    return true;
  }
 else {
    isNeedToCloseWithoutRedirect=false;
  }
  return super.dispatchKeyEvent(event);
}
Program: 114478
Project: 114478
Buggy source:
private void tryLogin() throws XMPPException, IOException, SmackException {
  long startTime=new Date().getTime();
  long currentTime=startTime;
  while (!chatRestHelper.isLoggedIn() && (currentTime - startTime) < Consts.LOGIN_TIMEOUT) {
    currentTime=new Date().getTime();
    try {
      chatRestHelper.login(AppSession.getSession().getUser());
    }
 catch (    SmackException ignore) {
    }
  }
}

Fixed version (ground truth):
private void tryLogin() throws XMPPException, IOException, SmackException, QBResponseException {
  long startTime=new Date().getTime();
  long currentTime=startTime;
  while (!chatRestHelper.isLoggedIn() && (currentTime - startTime) < Consts.LOGIN_TIMEOUT) {
    currentTime=new Date().getTime();
    try {
      chatRestHelper.login(AppSession.getSession().getUser());
    }
 catch (    SmackException ignore) {
    }
  }
}
Program: 114479
Project: 114479
Buggy source:
public synchronized void login(QBUser user) throws XMPPException, IOException, SmackException {
  if (!QBChatService.isInitialized()) {
    QBChatService.init(context);
    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 != null) {
    logout();
    destroy();
  }
  if (!QBChatService.isInitialized()) {
    QBChatService.init(context);
    chatService=QBChatService.getInstance();
    chatService.addConnectionListener(connectionListener);
  }
  if (!chatService.isLoggedIn() && user != null) {
    chatService.login(user);
    chatService.startAutoSendPresence(AUTO_PRESENCE_INTERVAL_IN_SECONDS);
  }
}
Program: 114480
Project: 114480
Buggy source:
@Override public void execute(Bundle bundle){
  Exception exception=(Exception)bundle.getSerializable(QBServiceConsts.EXTRA_ERROR);
  hideProgress();
  DialogUtils.showLong(ChangePasswordActivity.this,exception.getMessage());
  updatePasswords(oldPasswordText,oldPasswordText);
  clearFields();
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  Exception exception=(Exception)bundle.getSerializable(QBServiceConsts.EXTRA_ERROR);
  hideProgress();
  DialogUtils.showLong(ChangePasswordActivity.this,exception.getMessage());
  updatePasswords(oldPasswordText,oldPasswordText);
  clearFieldNewPassword();
}
Program: 114481
Project: 114481
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_profile);
  useDoubleBackPressed=false;
  user=AppSession.getSession().getUser();
  imageHelper=new ImageHelper(this);
  initUI();
  initListeners();
  initUIWithUsersData();
  initBroadcastActionList();
  initTextChangedListeners();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_profile);
  useDoubleBackPressed=false;
  user=AppSession.getSession().getUser();
  imageHelper=new ImageHelper(this);
  initUI();
  initListeners();
  initUIWithUsersData();
  initBroadcastActionList();
  initTextChangedListeners();
  updateOldUserData();
}
Program: 114482
Project: 114482
Buggy source:
@Override protected Bundle perform(Bundle extras) throws Exception {
  ArrayList<String> friendsFacebookList=extras.getStringArrayList(QBServiceConsts.EXTRA_FRIENDS_FACEBOOK);
  ArrayList<String> friendsContactsList=extras.getStringArrayList(QBServiceConsts.EXTRA_FRIENDS_CONTACTS);
  Bundle params=new Bundle();
  QBPagedRequestBuilder requestBuilder=new QBPagedRequestBuilder();
  requestBuilder.setPage(Consts.FL_FRIENDS_PAGE_NUM);
  requestBuilder.setPerPage(Consts.FL_FRIENDS_PER_PAGE);
  List<QBUser> realFriendsFacebookList=QBUsers.getUsersByFacebookId(friendsFacebookList,requestBuilder,params);
  List<QBUser> realFriendsContactsList=QBUsers.getUsersByEmails(friendsContactsList,requestBuilder,params);
  List<Integer> realFriendsList=getSelectedUsersList(realFriendsFacebookList,realFriendsContactsList);
  for (  int userId : realFriendsList) {
    friendListHelper.inviteFriend(userId);
  }
  Bundle result=new Bundle();
  result.putSerializable(QBServiceConsts.EXTRA_FRIENDS,(java.io.Serializable)realFriendsList);
  return result;
}

Fixed version (ground truth):
@Override protected Bundle perform(Bundle extras) throws Exception {
  ArrayList<String> friendsFacebookList=extras.getStringArrayList(QBServiceConsts.EXTRA_FRIENDS_FACEBOOK);
  ArrayList<String> friendsContactsList=extras.getStringArrayList(QBServiceConsts.EXTRA_FRIENDS_CONTACTS);
  Bundle params=new Bundle();
  QBPagedRequestBuilder requestBuilder=new QBPagedRequestBuilder();
  requestBuilder.setPage(Consts.FL_FRIENDS_PAGE_NUM);
  requestBuilder.setPerPage(Consts.FL_FRIENDS_PER_PAGE);
  List<QBUser> realFriendsFacebookList=null;
  List<QBUser> realFriendsContactsList=null;
  if (!friendsFacebookList.isEmpty()) {
    realFriendsFacebookList=QBUsers.getUsersByFacebookId(friendsFacebookList,requestBuilder,params);
  }
  if (!friendsContactsList.isEmpty()) {
    realFriendsContactsList=QBUsers.getUsersByEmails(friendsContactsList,requestBuilder,params);
  }
  List<Integer> realFriendsList=getSelectedUsersList(realFriendsFacebookList,realFriendsContactsList);
  for (  int userId : realFriendsList) {
    friendListHelper.inviteFriend(userId);
  }
  Bundle result=new Bundle();
  result.putSerializable(QBServiceConsts.EXTRA_FRIENDS,(java.io.Serializable)realFriendsList);
  return result;
}