nus-yam/ex-repair huggingface dataset:
Program: 114483
Project: 114483
Buggy source:
private void getFacebookFriendsList(){
  Request.executeMyFriendsRequestAsync(Session.getActiveSession(),new Request.GraphUserListCallback(){
    @Override public void onCompleted(    List<com.facebook.model.GraphUser> users,    Response response){
      friendsFacebookList=new ArrayList<InviteFriend>();
      for (      com.facebook.model.GraphUser user : users) {
        friendsFacebookList.add(new InviteFriend(user.getId(),user.getName(),user.getLink(),InviteFriend.VIA_FACEBOOK_TYPE,null,false));
      }
      fiendsReceived();
    }
  }
);
}

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

Fixed version (ground truth):
@Override public void onCompleted(List<com.facebook.model.GraphUser> users,Response response){
  for (  com.facebook.model.GraphUser user : users) {
    friendsFacebookList.add(new InviteFriend(user.getId(),user.getName(),user.getLink(),InviteFriend.VIA_FACEBOOK_TYPE,null,false));
  }
  fiendsReceived();
}
Program: 114485
Project: 114485
Buggy source:
private List<String> getIdsList(List<InviteFriend> friendsList){
  List<String> idsList=new ArrayList<String>();
  for (  InviteFriend friend : friendsList) {
    idsList.add(friend.getId());
  }
  return idsList;
}

Fixed version (ground truth):
private List<String> getIdsList(List<InviteFriend> friendsList){
  if (friendsList.isEmpty()) {
    return new ArrayList<String>();
  }
  List<String> idsList=new ArrayList<String>();
  for (  InviteFriend friend : friendsList) {
    idsList.add(friend.getId());
  }
  return idsList;
}
Program: 114486
Project: 114486
Buggy source:
public ImportFriends(Activity activity,FacebookHelper facebookHelper){
  this.activity=activity;
  this.facebookHelper=facebookHelper;
  this.facebookHelper.loginWithFacebook();
}

Fixed version (ground truth):
public ImportFriends(Activity activity,FacebookHelper facebookHelper){
  this.activity=activity;
  this.facebookHelper=facebookHelper;
  this.facebookHelper.loginWithFacebook();
  friendsFacebookList=new ArrayList<InviteFriend>();
  friendsContactsList=new ArrayList<InviteFriend>();
}
Program: 114487
Project: 114487
Buggy source:
@Override public Bundle perform(Bundle extras) throws Exception {
  String socialProvider=(String)extras.getSerializable(QBServiceConsts.EXTRA_SOCIAL_PROVIDER);
  String accessToken=(String)extras.getSerializable(QBServiceConsts.EXTRA_ACCESS_TOKEN);
  String accessTokenSecret=(String)extras.getSerializable(QBServiceConsts.EXTRA_ACCESS_TOKEN_SECRET);
  QBUser user=authHelper.login(socialProvider,accessToken,accessTokenSecret);
  if (TextUtils.isEmpty(user.getWebsite())) {
    QBUser newUser=new QBUser();
    newUser.setId(user.getId());
    newUser.setPassword(user.getPassword());
    newUser.setWebsite(context.getString(R.string.inf_url_to_facebook_avatar,user.getFacebookId()));
    extras.putSerializable(QBServiceConsts.EXTRA_USER,newUser);
  }
 else {
    extras.putSerializable(QBServiceConsts.EXTRA_USER,user);
  }
  return extras;
}

Fixed version (ground truth):
@Override public Bundle perform(Bundle extras) throws Exception {
  String socialProvider=(String)extras.getSerializable(QBServiceConsts.EXTRA_SOCIAL_PROVIDER);
  String accessToken=(String)extras.getSerializable(QBServiceConsts.EXTRA_ACCESS_TOKEN);
  String accessTokenSecret=(String)extras.getSerializable(QBServiceConsts.EXTRA_ACCESS_TOKEN_SECRET);
  QBUser user=authHelper.login(socialProvider,accessToken,accessTokenSecret);
  if (TextUtils.isEmpty(user.getWebsite())) {
    QBUser newUser=new QBUser();
    newUser.setId(user.getId());
    newUser.setPassword(user.getPassword());
    newUser.setWebsite(context.getString(R.string.inf_url_to_facebook_avatar,user.getFacebookId()));
    App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,false);
    extras.putSerializable(QBServiceConsts.EXTRA_USER,newUser);
  }
 else {
    App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,true);
    extras.putSerializable(QBServiceConsts.EXTRA_USER,user);
  }
  return extras;
}
Program: 114488
Project: 114488
Buggy source:
@Override public void execute(Bundle bundle){
  QBUser user=(QBUser)bundle.getSerializable(QBServiceConsts.EXTRA_USER);
  App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,true);
  startMainActivity(user);
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  QBUser user=(QBUser)bundle.getSerializable(QBServiceConsts.EXTRA_USER);
  startMainActivity(user);
}
Program: 114489
Project: 114489
Buggy source:
public void loginOnClickListener(View view){
  String userEmail=emailEditText.getText().toString();
  String userPassword=passwordEditText.getText().toString();
  if (validationUtils.isValidUserDate(userEmail,userPassword)) {
    login(userEmail,userPassword);
  }
}

Fixed version (ground truth):
public void loginOnClickListener(View view){
  String userEmail=emailEditText.getText().toString();
  String userPassword=passwordEditText.getText().toString();
  if (validationUtils.isValidUserDate(userEmail,userPassword)) {
    App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,true);
    login(userEmail,userPassword);
  }
}
Program: 114490
Project: 114490
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  useDoubleBackPressed=true;
  initPrefValues();
  gsmHelper=new GSMHelper(this);
  initNavigationDrawer();
  if (!isImportInitialized && isSignUpInitialized) {
    showProgress();
    facebookHelper=new FacebookHelper(this,savedInstanceState,new FacebookSessionStatusCallback());
    importFriends=new ImportFriends(MainActivity.this,facebookHelper);
    App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_SIGN_UP_INITIALIZED,false);
  }
  checkGCMRegistration();
  loadFriendsList();
  loadChatsDialogs();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  useDoubleBackPressed=true;
  initPrefValues();
  gsmHelper=new GSMHelper(this);
  initNavigationDrawer();
  if (!isImportInitialized) {
    showProgress();
    facebookHelper=new FacebookHelper(this,savedInstanceState,new FacebookSessionStatusCallback());
    importFriends=new ImportFriends(MainActivity.this,facebookHelper);
    App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_SIGN_UP_INITIALIZED,false);
  }
  checkGCMRegistration();
  loadFriendsList();
  loadChatsDialogs();
}
Program: 114491
Project: 114491
Buggy source:
public void signUpOnClickListener(View view){
  String fullNameText=fullnameEditText.getText().toString();
  String emailText=emailEditText.getText().toString();
  String passwordText=passwordEditText.getText().toString();
  if (validationUtils.isValidUserDate(fullNameText,emailText,passwordText)) {
    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);
    }
  }
}

Fixed version (ground truth):
public void signUpOnClickListener(View view){
  String fullNameText=fullnameEditText.getText().toString();
  String emailText=emailEditText.getText().toString();
  String passwordText=passwordEditText.getText().toString();
  if (validationUtils.isValidUserDate(fullNameText,emailText,passwordText)) {
    qbUser.setFullName(fullNameText);
    qbUser.setEmail(emailText);
    qbUser.setPassword(passwordText);
    showProgress();
    if (isNeedUpdateAvatar) {
      new ReceiveImageFileTask(this).execute(imageHelper,avatarBitmapCurrent,true);
    }
 else {
      App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,false);
      QBSignUpCommand.start(SignUpActivity.this,qbUser,null);
    }
  }
}
Program: 114492
Project: 114492
Buggy source:
public void onCompleted(Response response){
  FacebookRequestError error=response.getError();
  if (error != null) {
    Log.e(getString(R.string.facebook_exception),error);
    DialogUtils.showLong(getActivity(),getResources().getString(R.string.facebook_exception) + error);
  }
 else {
    DialogUtils.showLong(getActivity(),getResources().getString(R.string.dlg_success_posted_to_facebook));
  }
  baseActivity.hideProgress();
}

Fixed version (ground truth):
public void onCompleted(Response response){
  FacebookRequestError error=response.getError();
  if (error != null) {
    Log.e(getString(R.string.facebook_exception),error.toString());
    DialogUtils.showLong(getActivity(),getResources().getString(R.string.facebook_exception) + error);
  }
 else {
    DialogUtils.showLong(getActivity(),getResources().getString(R.string.dlg_success_posted_to_facebook));
  }
  baseActivity.hideProgress();
}
Program: 114493
Project: 114493
Buggy source:
private void tryLogin() throws XMPPException, IOException, SmackException {
  long startTime=new Date().getTime();
  long currentTime=startTime;
  while (!chatHelper.isLoggedIn() && (currentTime - startTime) < Consts.LOGIN_TIMEOUT) {
    currentTime=new Date().getTime();
    try {
      chatHelper.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 (!chatHelper.isLoggedIn() && (currentTime - startTime) < Consts.LOGIN_TIMEOUT) {
    currentTime=new Date().getTime();
    chatHelper.login(AppSession.getSession().getUser());
  }
}
Program: 114494
Project: 114494
Buggy source:
@Override public Bundle perform(Bundle extras) throws Exception {
  QBUser user=(QBUser)extras.getSerializable(QBServiceConsts.EXTRA_USER);
  user=authHelper.login(user);
  extras.putSerializable(QBServiceConsts.EXTRA_USER,user);
  AppSession.startSession(LoginType.EMAIL,user);
  return extras;
}

Fixed version (ground truth):
@Override public Bundle perform(Bundle extras) throws Exception {
  QBUser user=(QBUser)extras.getSerializable(QBServiceConsts.EXTRA_USER);
  user=authHelper.login(user);
  extras.putSerializable(QBServiceConsts.EXTRA_USER,user);
  return extras;
}
Program: 114495
Project: 114495
Buggy source:
@Override public Bundle perform(Bundle extras) throws Exception {
  String socialProvider=(String)extras.getSerializable(QBServiceConsts.EXTRA_SOCIAL_PROVIDER);
  String accessToken=(String)extras.getSerializable(QBServiceConsts.EXTRA_ACCESS_TOKEN);
  String accessTokenSecret=(String)extras.getSerializable(QBServiceConsts.EXTRA_ACCESS_TOKEN_SECRET);
  QBUser user=authHelper.login(socialProvider,accessToken,accessTokenSecret);
  if (TextUtils.isEmpty(user.getWebsite())) {
    QBUser newUser=new QBUser();
    newUser.setId(user.getId());
    newUser.setPassword(user.getPassword());
    newUser.setWebsite(context.getString(R.string.inf_url_to_facebook_avatar,user.getFacebookId()));
    extras.putSerializable(QBServiceConsts.EXTRA_USER,newUser);
    AppSession.startSession(LoginType.FACEBOOK,newUser);
  }
 else {
    extras.putSerializable(QBServiceConsts.EXTRA_USER,user);
    AppSession.startSession(LoginType.FACEBOOK,user);
  }
  return extras;
}

Fixed version (ground truth):
@Override public Bundle perform(Bundle extras) throws Exception {
  String socialProvider=(String)extras.getSerializable(QBServiceConsts.EXTRA_SOCIAL_PROVIDER);
  String accessToken=(String)extras.getSerializable(QBServiceConsts.EXTRA_ACCESS_TOKEN);
  String accessTokenSecret=(String)extras.getSerializable(QBServiceConsts.EXTRA_ACCESS_TOKEN_SECRET);
  QBUser user=authHelper.login(socialProvider,accessToken,accessTokenSecret);
  if (TextUtils.isEmpty(user.getWebsite())) {
    QBUser newUser=new QBUser();
    newUser.setId(user.getId());
    newUser.setPassword(user.getPassword());
    newUser.setWebsite(context.getString(R.string.inf_url_to_facebook_avatar,user.getFacebookId()));
    extras.putSerializable(QBServiceConsts.EXTRA_USER,newUser);
  }
 else {
    extras.putSerializable(QBServiceConsts.EXTRA_USER,user);
  }
  return extras;
}
Program: 114496
Project: 114496
Buggy source:
public void logout() throws QBResponseException {
  AppSession activeSession=AppSession.getSession();
  if (activeSession != null) {
    activeSession.closeAndClear();
  }
  Session.getActiveSession().closeAndClearTokenInformation();
  QBAuth.deleteSession();
  user=null;
}

Fixed version (ground truth):
public void logout() throws QBResponseException {
  AppSession activeSession=AppSession.getSession();
  if (activeSession != null) {
    activeSession.closeAndClear();
  }
  Session.getActiveSession().closeAndClearTokenInformation();
  QBAuth.deleteSession();
}
Program: 114497
Project: 114497
Buggy source:
public QBUser login(String socialProvider,String accessToken,String accessTokenSecret) throws QBResponseException {
  QBSession session=QBAuth.createSession();
  user=QBUsers.signInUsingSocialProvider(socialProvider,accessToken,accessTokenSecret);
  user.setPassword(session.getToken());
  return user;
}

Fixed version (ground truth):
public QBUser login(String socialProvider,String accessToken,String accessTokenSecret) throws QBResponseException {
  QBUser user;
  QBSession session=QBAuth.createSession();
  user=QBUsers.signInUsingSocialProvider(socialProvider,accessToken,accessTokenSecret);
  user.setPassword(session.getToken());
  AppSession.startSession(LoginType.FACEBOOK,user);
  return user;
}
Program: 114498
Project: 114498
Buggy source:
public QBUser signup(QBUser user,File file) throws QBResponseException {
  QBAuth.createSession();
  String password=user.getPassword();
  user.setOldPassword(password);
  this.user=QBUsers.signUpSignInTask(user);
  if (null != file) {
    QBFile qbFile=QBContent.uploadFileTask(file,true,(String)null);
    this.user.setWebsite(qbFile.getPublicUrl());
    this.user=QBUsers.updateUser(user);
  }
  this.user.setPassword(password);
  return user;
}

Fixed version (ground truth):
public QBUser signup(QBUser inputUser,File file) throws QBResponseException {
  QBUser user;
  QBAuth.createSession();
  String password=inputUser.getPassword();
  inputUser.setOldPassword(password);
  user=QBUsers.signUpSignInTask(inputUser);
  if (null != file) {
    QBFile qbFile=QBContent.uploadFileTask(file,true,(String)null);
    user.setWebsite(qbFile.getPublicUrl());
    user=QBUsers.updateUser(inputUser);
  }
  user.setPassword(password);
  AppSession.startSession(LoginType.EMAIL,user);
  return inputUser;
}
Program: 114499
Project: 114499
Buggy source:
public synchronized void login(QBUser user) throws XMPPException, IOException, SmackException {
  if (!QBChatService.isInitialized()) {
    QBChatService.init(context);
    chatService=QBChatService.getInstance();
  }
  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();
  }
  if (user != null) {
    chatService.login(user);
    chatService.startAutoSendPresence(AUTO_PRESENCE_INTERVAL_IN_SECONDS);
  }
}
Program: 114500
Project: 114500
Buggy source:
@Override public void execute(Bundle bundle){
  QBUser user=(QBUser)bundle.getSerializable(QBServiceConsts.EXTRA_USER);
  App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,true);
  AppSession.startSession(LoginType.FACEBOOK,user);
  startMainActivity(user);
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  QBUser user=(QBUser)bundle.getSerializable(QBServiceConsts.EXTRA_USER);
  App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,true);
  startMainActivity(user);
}
Program: 114501
Project: 114501
Buggy source:
@Override public void execute(Bundle bundle){
  QBUser user=(QBUser)bundle.getSerializable(QBServiceConsts.EXTRA_USER);
  AppSession.startSession(getCurrentLoginType(),user);
  App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,true);
  MainActivity.start(SplashActivity.this);
  finish();
}

Fixed version (ground truth):
@Override public void execute(Bundle bundle){
  QBUser user=(QBUser)bundle.getSerializable(QBServiceConsts.EXTRA_USER);
  App.getInstance().getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED,true);
  MainActivity.start(SplashActivity.this);
  finish();
}
Program: 114502
Project: 114502
Buggy source:
public BaseCursorAdapter(Context context,Cursor cursor,boolean autoRequery){
  super(context,cursor,autoRequery);
  this.context=context;
  resources=context.getResources();
  layoutInflater=LayoutInflater.from(context);
  currentUser=AppSession.getSession().getUser();
  currentLoginType=AppSession.getSession().getLoginType();
  imageHelper=new ImageHelper((android.app.Activity)context);
}

Fixed version (ground truth):
public BaseCursorAdapter(Context context,Cursor cursor,boolean autoRequery){
  super(context,cursor,autoRequery);
  this.context=context;
  resources=context.getResources();
  layoutInflater=LayoutInflater.from(context);
  currentUser=AppSession.getSession().getUser();
  currentLoginType=AppSession.getSession().getLoginType();
}
Program: 114503
Project: 114503
Buggy source:
public BaseDialogMessagesAdapter(Context context,Cursor cursor){
  super(context,cursor,true);
  random=new Random();
  colorsMap=new HashMap<Integer,Integer>();
}

Fixed version (ground truth):
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);
}
Program: 114504
Project: 114504
Buggy source:
public static Bitmap generateMask(Context context,Bitmap mask,Bitmap original){
  int width=SizeUtility.dipToPixels(context,Consts.CHAT_ATTACH_WIDTH);
  int height=SizeUtility.dipToPixels(context,Consts.CHAT_ATTACH_HEIGHT);
  original=ImageHelper.getScaledBitmap(original,original.getWidth(),original.getHeight(),width);
  Bitmap result=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  mask=getNinepatch(context.getResources(),mask,width,height);
  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 static Bitmap generateMask(Context context,Bitmap mask,Bitmap original){
  int width=SizeUtility.dipToPixels(context,Consts.CHAT_ATTACH_WIDTH);
  original=ImageHelper.getScaledBitmap(original,original.getWidth(),original.getHeight(),width);
  Bitmap result=Bitmap.createBitmap(width,original.getHeight(),Bitmap.Config.ARGB_8888);
  mask=getNinepatch(context.getResources(),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: 114505
Project: 114505
Buggy source:
public static Bitmap getScaledBitmap(Bitmap bitmapOrg,int width,int height,int preferredWidth){
  int newWidth=preferredWidth;
  int newHeight=preferredWidth;
  float scaleWidth=((float)newWidth) / width;
  float scaleHeight=((float)newHeight) / height;
  Matrix matrix=new Matrix();
  matrix.postScale(scaleWidth,scaleHeight);
  Bitmap resizedBitmap=Bitmap.createBitmap(bitmapOrg,Consts.ZERO_INT_VALUE,Consts.ZERO_INT_VALUE,width,height,matrix,true);
  return resizedBitmap;
}

Fixed version (ground truth):
public static Bitmap getScaledBitmap(Bitmap bitmapOrg,int width,int height,int preferredWidth){
  float scaleValue=((float)preferredWidth) / width;
  Matrix matrix=new Matrix();
  matrix.postScale(scaleValue,scaleValue);
  Bitmap resizedBitmap=Bitmap.createBitmap(bitmapOrg,Consts.ZERO_INT_VALUE,Consts.ZERO_INT_VALUE,width,height,matrix,true);
  return resizedBitmap;
}
Program: 114506
Project: 114506
Buggy source:
public synchronized void login(QBUser user) throws XMPPException, IOException, SmackException {
  if (!QBChatService.isInitialized()) {
    QBChatService.init(context);
    chatService=QBChatService.getInstance();
  }
  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 {
  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: 114507
Project: 114507
Buggy source:
private void fillFriendOnlineStatus(Friend friend){
  QBPresence presence=roster.getPresence(friend.getId());
  if (presence.getType() == QBPresence.Type.online) {
    friend.setOnline(true);
  }
 else {
    friend.setOnline(false);
  }
}

Fixed version (ground truth):
private void fillFriendOnlineStatus(Friend friend){
  QBPresence presence=roster.getPresence(friend.getId());
  if (presence == null) {
    return;
  }
  if (presence.getType() == QBPresence.Type.online) {
    friend.setOnline(true);
  }
 else {
    friend.setOnline(false);
  }
}
Program: 114508
Project: 114508
Buggy source:
@Override public void presenceChanged(QBPresence presence){
  Friend friend=DatabaseManager.getFriendById(context,presence.getUserId());
  fillFriendOnlineStatus(friend);
  fillFriendStatus(friend);
  DatabaseManager.saveFriend(context,friend);
  notifyFriendStatusChanged(friend);
}

Fixed version (ground truth):
@Override public void presenceChanged(QBPresence presence){
  Friend friend=DatabaseManager.getFriendById(context,presence.getUserId());
  if (friend == null) {
    ErrorUtils.logError(TAG,"String_Node_Str" + friend.getId());
    return;
  }
  fillFriendOnlineStatus(friend);
  fillFriendStatus(friend);
  DatabaseManager.saveFriend(context,friend);
  notifyFriendStatusChanged(friend);
}
Program: 114509
Project: 114509
Buggy source:
public static void start(Context context,String message,QBFile file){
  Intent intent=new Intent(QBServiceConsts.SEND_GROUP_MESSAGE_ACTION,null,context,QBService.class);
  intent.putExtra(QBServiceConsts.EXTRA_CHAT_MESSAGE,message);
  intent.putExtra(QBServiceConsts.EXTRA_QBFILE,file);
  context.startService(intent);
}

Fixed version (ground truth):
public static void start(Context context,String roomJidId,String message,QBFile file){
  Intent intent=new Intent(QBServiceConsts.SEND_GROUP_MESSAGE_ACTION,null,context,QBService.class);
  intent.putExtra(QBServiceConsts.EXTRA_ROOM_JID,roomJidId);
  intent.putExtra(QBServiceConsts.EXTRA_CHAT_MESSAGE,message);
  intent.putExtra(QBServiceConsts.EXTRA_QBFILE,file);
  context.startService(intent);
}
Program: 114510
Project: 114510
Buggy source:
@Override protected Bundle perform(Bundle extras) throws Exception {
  String message=extras.getString(QBServiceConsts.EXTRA_CHAT_MESSAGE);
  QBFile file=(QBFile)extras.getSerializable(QBServiceConsts.EXTRA_QBFILE);
  if (file == null) {
    chatHelper.sendGroupMessage(message);
  }
 else {
    chatHelper.sendGroupMessageWithAttachImage(file);
  }
  return null;
}

Fixed version (ground truth):
@Override protected Bundle perform(Bundle extras) throws Exception {
  String roomJidId=extras.getString(QBServiceConsts.EXTRA_ROOM_JID);
  String message=extras.getString(QBServiceConsts.EXTRA_CHAT_MESSAGE);
  QBFile file=(QBFile)extras.getSerializable(QBServiceConsts.EXTRA_QBFILE);
  if (file == null) {
    chatHelper.sendGroupMessage(roomJidId,message);
  }
 else {
    chatHelper.sendGroupMessageWithAttachImage(roomJidId,file);
  }
  return null;
}
Program: 114511
Project: 114511
Buggy source:
public void sendGroupMessage(String message) throws Exception {
  QBChatMessage chatMessage=getQBChatMessage(message);
  sendRoomMessage(chatMessage);
}

Fixed version (ground truth):
public void sendGroupMessage(String roomJidId,String message) throws Exception {
  roomChat=roomChatManager.getRoom(roomJidId);
  if (roomChat == null) {
    return;
  }
  QBChatMessage chatMessage=getQBChatMessage(message);
  sendRoomMessage(chatMessage);
}
Program: 114512
Project: 114512
Buggy source:
public synchronized void login(QBUser user) throws XMPPException, IOException, SmackException {
  if (!QBChatService.isInitialized()) {
    QBChatService.init(context);
    QBChatService.setDefaultPacketReplyTimeout(Consts.DEFAULT_PACKET_REPLY_TIMEOUT);
    chatService=QBChatService.getInstance();
  }
  if (!chatService.isLoggedIn() && user != null) {
    chatService.login(user);
    chatService.startAutoSendPresence(AUTO_PRESENCE_INTERVAL_IN_SECONDS);
    this.user=user;
  }
}

Fixed version (ground truth):
public synchronized void login(QBUser user) throws XMPPException, IOException, SmackException {
  if (!QBChatService.isInitialized()) {
    QBChatService.init(context);
    chatService=QBChatService.getInstance();
  }
  if (!chatService.isLoggedIn() && user != null) {
    chatService.login(user);
    chatService.startAutoSendPresence(AUTO_PRESENCE_INTERVAL_IN_SECONDS);
    this.user=user;
  }
}
Program: 114513
Project: 114513
Buggy source:
public void sendGroupMessageWithAttachImage(QBFile file) throws Exception {
  QBChatMessage chatMessage=getQBChatMessageWithImage(file);
  sendRoomMessage(chatMessage);
}

Fixed version (ground truth):
public void sendGroupMessageWithAttachImage(String roomJidId,QBFile file) throws Exception {
  roomChat=roomChatManager.getRoom(roomJidId);
  if (roomChat == null) {
    return;
  }
  QBChatMessage chatMessage=getQBChatMessageWithImage(file);
  sendRoomMessage(chatMessage);
}
Program: 114514
Project: 114514
Buggy source:
@Override protected void onFileLoaded(QBFile file){
  QBSendGroupDialogMessageCommand.start(GroupDialogActivity.this,null,file);
}

Fixed version (ground truth):
@Override protected void onFileLoaded(QBFile file){
  QBSendGroupDialogMessageCommand.start(GroupDialogActivity.this,chatJidId,null,file);
}
Program: 114515
Project: 114515
Buggy source:
public void sendMessageOnClick(View view){
  QBSendGroupDialogMessageCommand.start(this,messageEditText.getText().toString(),null);
  messageEditText.setText(Consts.EMPTY_STRING);
  scrollListView();
}

Fixed version (ground truth):
public void sendMessageOnClick(View view){
  QBSendGroupDialogMessageCommand.start(this,chatJidId,messageEditText.getText().toString(),null);
  messageEditText.setText(Consts.EMPTY_STRING);
  scrollListView();
}
Program: 114516
Project: 114516
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (getIntent().hasExtra(EXTRA_ROOM_JID)) {
    chatJidId=getIntent().getStringExtra(EXTRA_ROOM_JID);
  }
  initListView();
  registerForContextMenu(messagesListView);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (getIntent().hasExtra(EXTRA_ROOM_JID)) {
    chatJidId=getIntent().getStringExtra(EXTRA_ROOM_JID);
  }
  initListView();
  startLoadDialogMessages();
  registerForContextMenu(messagesListView);
}
Program: 114517
Project: 114517
Buggy source:
private void updateChatData(){
  dialog=DatabaseManager.getDialogByRoomJidId(this,chatJidId);
  groupName=dialog.getName();
  startLoadDialogMessages();
  updateActionBar();
}

Fixed version (ground truth):
private void updateChatData(){
  dialog=DatabaseManager.getDialogByRoomJidId(this,chatJidId);
  groupName=dialog.getName();
  updateActionBar();
}
Program: 114519
Project: 114519
Buggy source:
@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  View view;
  ViewHolder viewHolder=new ViewHolder();
  int senderId=cursor.getInt(cursor.getColumnIndex(DialogMessageTable.Cols.SENDER_ID));
  if (isOwnMessage(senderId)) {
    view=layoutInflater.inflate(R.layout.list_item_dialog_own_message,null,true);
  }
 else {
    view=layoutInflater.inflate(R.layout.list_item_private_dialog_opponent_message,null,true);
  }
  viewHolder.attachMessageRelativeLayout=(RelativeLayout)view.findViewById(R.id.attach_message_relativelayout);
  viewHolder.timeAttachMessageTextView=(TextView)view.findViewById(R.id.time_attach_message_textview);
  viewHolder.progressRelativeLayout=(RelativeLayout)view.findViewById(R.id.progress_relativelayout);
  viewHolder.textMessageLinearLayout=(LinearLayout)view.findViewById(R.id.text_message_linearlayout);
  viewHolder.messageTextView=(ChatTextView)view.findViewById(R.id.message_textview);
  viewHolder.attachImageView=(ImageView)view.findViewById(R.id.attach_imageview);
  viewHolder.timeTextMessageTextView=(TextView)view.findViewById(R.id.time_text_message_textview);
  viewHolder.verticalProgressBar=(ProgressBar)view.findViewById(R.id.vertical_progressbar);
  viewHolder.verticalProgressBar.setProgressDrawable(context.getResources().getDrawable(R.drawable.vertical_progressbar));
  viewHolder.centeredProgressBar=(ProgressBar)view.findViewById(R.id.centered_progressbar);
  view.setTag(viewHolder);
  return view;
}

Fixed version (ground truth):
@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  View view;
  int senderId=cursor.getInt(cursor.getColumnIndex(DialogMessageTable.Cols.SENDER_ID));
  if (isOwnMessage(senderId)) {
    view=layoutInflater.inflate(R.layout.list_item_dialog_own_message,null,true);
  }
 else {
    view=layoutInflater.inflate(R.layout.list_item_private_dialog_opponent_message,null,true);
  }
  return view;
}
Program: 114520
Project: 114520
Buggy source:
private void initUI(){
  feedbackDescriptionEditText=_findViewById(R.id.feedback_description_edittext);
}

Fixed version (ground truth):
private void initUI(){
  actionBar.setHomeButtonEnabled(true);
  actionBar.setDisplayHomeAsUpEnabled(true);
  feedbackDescriptionEditText=_findViewById(R.id.feedback_description_edittext);
}
Program: 114521
Project: 114521
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_feedback,container,false);
  initUI(view);
  initListeners();
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_feedback,container,false);
  initUI(view);
  return view;
}
Program: 114522
Project: 114522
Buggy source:
public static QBDialog createTempPrivateDialogByRoomJidId(Context context,String roomJidId,String lastMessage,long dateSent,int lastSenderId){
  QBDialog dialog=new QBDialog();
  dialog.setRoomJid(roomJidId);
  Friend opponentFriend=getFriendById(context,Integer.parseInt(roomJidId));
  if (opponentFriend == null) {
    opponentFriend=new Friend();
    opponentFriend.setId(Integer.parseInt(roomJidId));
    opponentFriend.setFullname(roomJidId);
  }
  dialog.setName(opponentFriend.getFullname());
  ArrayList<Integer> occupantsIdsList=ChatUtils.getOccupantsIdsListForCreatePrivateDialog(opponentFriend.getId());
  dialog.setOccupantsIds(occupantsIdsList);
  dialog.setType(QBDialogType.PRIVATE);
  dialog.setLastMessage(lastMessage);
  dialog.setLastMessageDateSent(dateSent);
  dialog.setUnreadMessageCount(Consts.ZERO_INT_VALUE);
  dialog.setLastMessageUserId(lastSenderId);
  saveDialog(context,dialog,roomJidId);
  return dialog;
}

Fixed version (ground truth):
public static QBDialog createTempPrivateDialogByRoomJidId(Context context,String roomJidId,String lastMessage,long dateSent,int lastSenderId){
  QBDialog dialog=new QBDialog();
  dialog.setRoomJid(roomJidId);
  Friend opponentFriend=DatabaseManager.getFriendById(context,Integer.parseInt(roomJidId));
  if (opponentFriend == null) {
    opponentFriend=new Friend();
    opponentFriend.setId(Integer.parseInt(roomJidId));
    opponentFriend.setFullname(roomJidId);
  }
  dialog.setName(opponentFriend.getFullname());
  ArrayList<Integer> occupantsIdsList=ChatUtils.getOccupantsIdsListForCreatePrivateDialog(opponentFriend.getId());
  dialog.setOccupantsIds(occupantsIdsList);
  dialog.setType(QBDialogType.PRIVATE);
  dialog.setLastMessage(lastMessage);
  dialog.setLastMessageDateSent(dateSent);
  dialog.setUnreadMessageCount(Consts.ZERO_INT_VALUE);
  dialog.setLastMessageUserId(lastSenderId);
  DatabaseManager.saveDialog(context,dialog,roomJidId);
  return dialog;
}
Program: 114523
Project: 114523
Buggy source:
private void initStartLoadDialogMessages(){
  startLoadDialogMessages(dialog,chatJidId,Consts.ZERO_LONG_VALUE);
}

Fixed version (ground truth):
private void initStartLoadDialogMessages(){
  if (dialog != null) {
    startLoadDialogMessages(dialog,chatJidId,Consts.ZERO_LONG_VALUE);
  }
}
Program: 114524
Project: 114524
Buggy source:
@Override public void onResume(){
  super.onResume();
  if (isFriendsListLoaded) {
    checkVisibilityEmptyLabel();
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  if (isFriendsListLoaded && !isNeedToHideSearchView) {
    checkVisibilityEmptyLabel();
  }
}
Program: 114525
Project: 114525
Buggy source:
public static QBDialog parseDialogFromMessage(QBMessage chatMessage,String lastMessage,long dateSent){
  final int COUNT_START_VALUE=1;
  String dialogId=chatMessage.getProperty(PROPERTY_DIALOG_ID);
  String roomJid=chatMessage.getProperty(PROPERTY_ROOM_JID);
  String occupantsIds=chatMessage.getProperty(PROPERTY_OCCUPANTS_IDS);
  String dialogName=chatMessage.getProperty(PROPERTY_ROOM_NAME);
  String dialogTypeCode=chatMessage.getProperty(PROPERTY_DIALOG_TYPE_CODE);
  QBDialog dialog=new QBDialog(dialogId);
  dialog.setRoomJid(roomJid);
  dialog.setOccupantsIds(getOccupantsIdsListFromString(occupantsIds));
  dialog.setName(dialogName);
  dialog.setType(parseByCode(Integer.parseInt(dialogTypeCode)));
  dialog.setLastMessage(lastMessage);
  dialog.setLastMessageDateSent(dateSent);
  dialog.setUnreadMessageCount(COUNT_START_VALUE);
  return dialog;
}

Fixed version (ground truth):
public static QBDialog parseDialogFromMessage(QBMessage chatMessage,String lastMessage,long dateSent){
  String dialogId=chatMessage.getProperty(PROPERTY_DIALOG_ID);
  String roomJid=chatMessage.getProperty(PROPERTY_ROOM_JID);
  String occupantsIds=chatMessage.getProperty(PROPERTY_OCCUPANTS_IDS);
  String dialogName=chatMessage.getProperty(PROPERTY_ROOM_NAME);
  String dialogTypeCode=chatMessage.getProperty(PROPERTY_DIALOG_TYPE_CODE);
  QBDialog dialog=new QBDialog(dialogId);
  dialog.setRoomJid(roomJid);
  dialog.setOccupantsIds(getOccupantsIdsListFromString(occupantsIds));
  dialog.setName(dialogName);
  dialog.setType(parseByCode(Integer.parseInt(dialogTypeCode)));
  dialog.setLastMessage(lastMessage);
  dialog.setLastMessageDateSent(dateSent);
  dialog.setUnreadMessageCount(Consts.ZERO_INT_VALUE);
  return dialog;
}
Program: 114526
Project: 114526
Buggy source:
@Override public void onTextChanged(CharSequence charSequence,int start,int before,int count){
  super.onTextChanged(charSequence,start,before,count);
  emailEditText.setError(null);
}

Fixed version (ground truth):
@Override public void onTextChanged(CharSequence charSequence,int start,int before,int count){
  super.onTextChanged(charSequence,start,before,count);
  clearErrors();
}
Program: 114527
Project: 114527
Buggy source:
public void loginOnClickListener(View view){
  String userEmail=emailEditText.getText().toString();
  String userPassword=passwordEditText.getText().toString();
  boolean isEmailEntered=!TextUtils.isEmpty(userEmail);
  boolean isPasswordEntered=!TextUtils.isEmpty(userPassword);
  if (isEmailEntered && isPasswordEntered) {
    login(userEmail,userPassword);
  }
 else {
    DialogUtils.showLong(LoginActivity.this,getString(R.string.dlg_not_all_fields_entered));
  }
}

Fixed version (ground truth):
public void loginOnClickListener(View view){
  String userEmail=emailEditText.getText().toString();
  String userPassword=passwordEditText.getText().toString();
  if (isValidUserDate(userEmail,userPassword)) {
    login(userEmail,userPassword);
  }
}
Program: 114528
Project: 114528
Buggy source:
private void initListeners(){
  emailEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      emailEditText.setError(null);
    }
  }
);
}

Fixed version (ground truth):
private void initListeners(){
  emailEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      clearErrors();
    }
  }
);
  passwordEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      clearErrors();
    }
  }
);
}
Program: 114529
Project: 114529
Buggy source:
private void clearErrors(){
  fullnameEditText.setError(null);
  emailEditText.setError(null);
}

Fixed version (ground truth):
private void clearErrors(){
  fullnameEditText.setError(null);
  emailEditText.setError(null);
  passwordEditText.setError(null);
}
Program: 114530
Project: 114530
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 ReceiveImageFileTask(this).execute(imageHelper,avatarBitmapCurrent,true);
    }
 else {
      QBSignUpCommand.start(SignUpActivity.this,qbUser,null);
    }
  }
 else {
    DialogUtils.showLong(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();
  if (isValidUserDate(fullNameText,emailText,passwordText)) {
    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);
    }
  }
}
Program: 114531
Project: 114531
Buggy source:
private void setErrors(String errors){
  emailEditText.setError(errors);
  fullnameEditText.setError(errors);
}

Fixed version (ground truth):
private void setErrors(boolean isFullNameEntered,boolean isEmailEntered,boolean isPasswordEntered){
  fullnameEditText.setError(isFullNameEntered ? null : getString(R.string.dlg_not_fullname_field_entered));
  emailEditText.setError(isEmailEntered ? null : getString(R.string.dlg_not_email_field_entered));
  passwordEditText.setError(isPasswordEntered ? null : getString(R.string.dlg_not_password_field_entered));
}
Program: 114532
Project: 114532
Buggy source:
private void initListeners(){
  emailEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      clearErrors();
    }
  }
);
  fullnameEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      clearErrors();
    }
  }
);
}

Fixed version (ground truth):
private void initListeners(){
  emailEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      clearErrors();
    }
  }
);
  fullnameEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      clearErrors();
    }
  }
);
  passwordEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      clearErrors();
    }
  }
);
}
Program: 114533
Project: 114533
Buggy source:
public List<QBHistoryMessage> getDialogMessages(QBDialog dialog,String roomJidId,long lastDateLoad) throws QBResponseException {
  Bundle bundle=new Bundle();
  QBCustomObjectRequestBuilder customObjectRequestBuilder=new QBCustomObjectRequestBuilder();
  customObjectRequestBuilder.setPagesLimit(Consts.DIALOG_MESSAGES_PER_PAGE);
  if (lastDateLoad != Consts.ZERO_LONG_VALUE) {
    customObjectRequestBuilder.gt(com.quickblox.internal.module.chat.Consts.MESSAGE_DATE_SENT,lastDateLoad);
  }
  List<QBHistoryMessage> dialogMessagesList=QBChatService.getDialogMessages(dialog,customObjectRequestBuilder,bundle);
  if (dialogMessagesList != null) {
    boolean isPrivate=QBDialogType.PRIVATE.equals(dialog.getType());
    saveChatMessagesToCache(dialogMessagesList,roomJidId,isPrivate);
  }
  return dialogMessagesList;
}

Fixed version (ground truth):
public List<QBHistoryMessage> getDialogMessages(QBDialog dialog,String roomJidId,long lastDateLoad) throws QBResponseException {
  Bundle bundle=new Bundle();
  QBCustomObjectRequestBuilder customObjectRequestBuilder=new QBCustomObjectRequestBuilder();
  customObjectRequestBuilder.setPagesLimit(Consts.DIALOG_MESSAGES_PER_PAGE);
  if (lastDateLoad != Consts.ZERO_LONG_VALUE) {
    customObjectRequestBuilder.gt(com.quickblox.internal.module.chat.Consts.MESSAGE_DATE_SENT,lastDateLoad);
  }
  List<QBHistoryMessage> dialogMessagesList=QBChatService.getDialogMessages(dialog,customObjectRequestBuilder,bundle);
  boolean isPrivate=QBDialogType.PRIVATE.equals(dialog.getType());
  if (dialogMessagesList != null) {
    deleteMessagesByRoomJidId(roomJidId);
    saveChatMessagesToCache(dialogMessagesList,roomJidId,isPrivate);
  }
  return dialogMessagesList;
}
Program: 114534
Project: 114534
Buggy source:
private void startLoadDialogMessages(){
  if (messagesAdapter.isEmpty()) {
    startLoadDialogMessages(dialog,chatJidId,Consts.ZERO_LONG_VALUE);
  }
 else {
    startLoadDialogMessages(dialog,chatJidId,dialog.getLastMessageDateSent());
  }
}

Fixed version (ground truth):
private void startLoadDialogMessages(){
  startLoadDialogMessages(dialog,chatJidId,Consts.ZERO_LONG_VALUE);
}
Program: 114535
Project: 114535
Buggy source:
private void initStartLoadDialogMessages(){
  if (dialog != null && messagesAdapter.isEmpty()) {
    startLoadDialogMessages(dialog,chatJidId,Consts.ZERO_LONG_VALUE);
  }
 else   if (dialog != null && !messagesAdapter.isEmpty()) {
    startLoadDialogMessages(dialog,chatJidId,dialog.getLastMessageDateSent());
  }
}

Fixed version (ground truth):
private void initStartLoadDialogMessages(){
  startLoadDialogMessages(dialog,chatJidId,Consts.ZERO_LONG_VALUE);
}
Program: 114536
Project: 114536
Buggy source:
public static QBDialog parseDialogFromMessage(QBMessage chatMessage,String lastMessage,long dateSent){
  String dialogId=chatMessage.getProperty(PROPERTY_DIALOG_ID);
  String roomJid=chatMessage.getProperty(PROPERTY_ROOM_JID);
  String occupantsIds=chatMessage.getProperty(PROPERTY_OCCUPANTS_IDS);
  String dialogName=chatMessage.getProperty(PROPERTY_ROOM_NAME);
  String dialogTypeCode=chatMessage.getProperty(PROPERTY_DIALOG_TYPE_CODE);
  QBDialog dialog=new QBDialog(dialogId);
  dialog.setRoomJid(roomJid);
  dialog.setOccupantsIds(getOccupantsIdsListFromString(occupantsIds));
  dialog.setName(dialogName);
  dialog.setType(parseByCode(Integer.parseInt(dialogTypeCode)));
  dialog.setLastMessage(lastMessage);
  dialog.setLastMessageDateSent(dateSent);
  dialog.setUnreadMessageCount(Consts.ZERO_INT_VALUE);
  return dialog;
}

Fixed version (ground truth):
public static QBDialog parseDialogFromMessage(QBMessage chatMessage,String lastMessage,long dateSent){
  final int COUNT_START_VALUE=1;
  String dialogId=chatMessage.getProperty(PROPERTY_DIALOG_ID);
  String roomJid=chatMessage.getProperty(PROPERTY_ROOM_JID);
  String occupantsIds=chatMessage.getProperty(PROPERTY_OCCUPANTS_IDS);
  String dialogName=chatMessage.getProperty(PROPERTY_ROOM_NAME);
  String dialogTypeCode=chatMessage.getProperty(PROPERTY_DIALOG_TYPE_CODE);
  QBDialog dialog=new QBDialog(dialogId);
  dialog.setRoomJid(roomJid);
  dialog.setOccupantsIds(getOccupantsIdsListFromString(occupantsIds));
  dialog.setName(dialogName);
  dialog.setType(parseByCode(Integer.parseInt(dialogTypeCode)));
  dialog.setLastMessage(lastMessage);
  dialog.setLastMessageDateSent(dateSent);
  dialog.setUnreadMessageCount(COUNT_START_VALUE);
  return dialog;
}
Program: 114537
Project: 114537
Buggy source:
@Override public void onResume(){
  Crouton.cancelAllCroutons();
  checkVisibilityEmptyLabel();
  super.onResume();
}

Fixed version (ground truth):
@Override public void onResume(){
  Crouton.cancelAllCroutons();
  if (isChatsListLoaded) {
    checkVisibilityEmptyLabel();
  }
  super.onResume();
}
Program: 114538
Project: 114538
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_dialogs_list,container,false);
  initUI(view);
  initListeners();
  initChatsDialogs();
  Crouton.cancelAllCroutons();
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_dialogs_list,container,false);
  initUI(view);
  initListeners();
  initChatsDialogs();
  Crouton.cancelAllCroutons();
  addActions();
  return view;
}