nus-yam/ex-repair huggingface dataset:
Program: 180966
Project: 180966
Buggy source:
public void connect(Profile profile){
  mConnectAttempted=SystemClock.elapsedRealtime();
  mIsConnectingErrorPossible=true;
  queueCommand(new BluetoothJob(BluetoothCommand.CONNECT,this,profile));
}

Fixed version (ground truth):
public void connect(Profile profile){
  mConnectAttempted=SystemClock.elapsedRealtime();
  mIsConnectingErrorPossible=true;
  disconnectConnected(profile);
  queueCommand(new BluetoothJob(BluetoothCommand.CONNECT,this,profile));
}
Program: 180967
Project: 180967
Buggy source:
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,0);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}
Program: 180968
Project: 180968
Buggy source:
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,0);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}
Program: 180969
Project: 180969
Buggy source:
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,0);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}
Program: 180970
Project: 180970
Buggy source:
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,0);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}
Program: 180971
Project: 180971
Buggy source:
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,0);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  PackageInfo pkgInfo;
  try {
    mAppInfo=mPm.getApplicationInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
    pkgInfo=mPm.getPackageInfo(mAppInfo.packageName,PackageManager.GET_UNINSTALLED_PACKAGES);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,"String_Node_Str" + mAppInfo.packageName,e);
    showDialogInner(DLG_APP_NOT_FOUND);
    return;
  }
  refreshAppAttributes(pkgInfo);
}
Program: 180972
Project: 180972
Buggy source:
private void showCstorDialog(int dialogId){
  mDialogId=dialogId;
  showDialog(dialogId);
}

Fixed version (ground truth):
private void showCstorDialog(int dialogId){
  mDialogId=dialogId;
  mRetry=false;
  showDialog(dialogId);
}
Program: 180973
Project: 180973
Buggy source:
public void onDismiss(DialogInterface dialog){
  if (mRetry) {
    showCstorDialog(mDialogId);
  }
 else {
    removeDialog(mDialogId);
    if (mExternalIntent != null) {
      finish();
    }
  }
}

Fixed version (ground truth):
public void onDismiss(DialogInterface dialog){
  if (mRetry) {
    showCstorDialog(mDialogId);
  }
 else {
    removeDialog(mDialogId);
    updatePreferences(mState);
    if (mExternalIntent != null) {
      finish();
    }
  }
}
Program: 180974
Project: 180974
Buggy source:
@Override protected void onResume(){
  super.onResume();
  boolean patternExists=mLockPatternUtils.savedPatternExists();
  mLockEnabled.setEnabled(patternExists);
  mVisiblePattern.setEnabled(patternExists);
  mTactileFeedback.setEnabled(patternExists);
  mLockEnabled.setChecked(mLockPatternUtils.isLockPatternEnabled());
  mVisiblePattern.setChecked(mLockPatternUtils.isVisiblePatternEnabled());
  mTactileFeedback.setChecked(mLockPatternUtils.isTactileFeedbackEnabled());
  int chooseStringRes=mLockPatternUtils.savedPatternExists() ? R.string.lockpattern_settings_change_lock_pattern : R.string.lockpattern_settings_choose_lock_pattern;
  mChoosePattern.setTitle(chooseStringRes);
  mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.TEXT_SHOW_PASSWORD,1) != 0);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  boolean patternExists=mLockPatternUtils.savedPatternExists();
  mLockEnabled.setEnabled(patternExists);
  mVisiblePattern.setEnabled(patternExists);
  mTactileFeedback.setEnabled(patternExists);
  mLockEnabled.setChecked(mLockPatternUtils.isLockPatternEnabled());
  mVisiblePattern.setChecked(mLockPatternUtils.isVisiblePatternEnabled());
  mTactileFeedback.setChecked(mLockPatternUtils.isTactileFeedbackEnabled());
  int chooseStringRes=mLockPatternUtils.savedPatternExists() ? R.string.lockpattern_settings_change_lock_pattern : R.string.lockpattern_settings_choose_lock_pattern;
  mChoosePattern.setTitle(chooseStringRes);
  mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.TEXT_SHOW_PASSWORD,1) != 0);
  mCstorHelper.resume();
}
Program: 180975
Project: 180975
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  String userSafetylegalUrl=SystemProperties.get(PROPERTY_LSAFETYLEGAL_URL);
  final Configuration configuration=getResources().getConfiguration();
  final String language=configuration.locale.getLanguage();
  final String country=configuration.locale.getCountry();
  String loc=String.format("String_Node_Str",language,country);
  userSafetylegalUrl=String.format("String_Node_Str",userSafetylegalUrl,loc);
  if (!isDataNetworkConnected()) {
    showErrorAndFinish(userSafetylegalUrl);
    return;
  }
  WebView webView=new WebView(this);
  webView.getSettings().setJavaScriptEnabled(true);
  webView.loadUrl(userSafetylegalUrl);
  webView.setWebViewClient(new WebViewClient(){
    @Override public void onPageFinished(    WebView view,    String url){
      mAlert.setTitle(getString(R.string.settings_safetylegal_activity_title));
    }
  }
);
  final AlertController.AlertParams p=mAlertParams;
  p.mTitle=getString(R.string.settings_safetylegal_activity_loading);
  p.mView=webView;
  p.mForceInverseBackground=true;
  setupAlert();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  String userSafetylegalUrl=SystemProperties.get(PROPERTY_LSAFETYLEGAL_URL);
  final Configuration configuration=getResources().getConfiguration();
  final String language=configuration.locale.getLanguage();
  final String country=configuration.locale.getCountry();
  String loc=String.format("String_Node_Str",language,country);
  userSafetylegalUrl=String.format("String_Node_Str",userSafetylegalUrl,loc);
  mWebView=new WebView(this);
  mWebView.getSettings().setJavaScriptEnabled(true);
  mWebView.loadUrl(userSafetylegalUrl);
  mWebView.setWebViewClient(new WebViewClient(){
    @Override public void onPageFinished(    WebView view,    String url){
      mAlert.setTitle(getString(R.string.settings_safetylegal_activity_title));
    }
    @Override public void onReceivedError(    WebView view,    int errorCode,    String description,    String failingUrl){
      showErrorAndFinish(failingUrl);
    }
  }
);
  final AlertController.AlertParams p=mAlertParams;
  p.mTitle=getString(R.string.settings_safetylegal_activity_loading);
  p.mView=mWebView;
  p.mForceInverseBackground=true;
  setupAlert();
}
Program: 180976
Project: 180976
Buggy source:
private void showErrorAndFinish(String url){
  new AlertDialog.Builder(this).setMessage(getResources().getString(R.string.settings_safetylegal_activity_unreachable,url)).setTitle(R.string.settings_safetylegal_activity_title).setPositiveButton(android.R.string.ok,mOkListener).setCancelable(true).show();
}

Fixed version (ground truth):
private void showErrorAndFinish(String url){
  new AlertDialog.Builder(this).setMessage(getResources().getString(R.string.settings_safetylegal_activity_unreachable,url)).setTitle(R.string.settings_safetylegal_activity_title).setPositiveButton(android.R.string.ok,this).setOnCancelListener(this).setCancelable(true).show();
}
Program: 180978
Project: 180978
Buggy source:
private void fetchName(){
  mName=mDevice.getName();
  if (TextUtils.isEmpty(mName)) {
    mName=mDevice.getAddress();
  }
}

Fixed version (ground truth):
private void fetchName(){
  mName=mDevice.getName();
  if (TextUtils.isEmpty(mName)) {
    mName=mDevice.getAddress();
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + mName);
  }
}
Program: 180979
Project: 180979
Buggy source:
public void connect(Profile profile){
  mIsConnectingErrorPossible=true;
  queueCommand(new BluetoothJob(BluetoothCommand.CONNECT,this,profile));
}

Fixed version (ground truth):
public void connect(Profile profile){
  mConnectAttempted=SystemClock.elapsedRealtime();
  mIsConnectingErrorPossible=true;
  queueCommand(new BluetoothJob(BluetoothCommand.CONNECT,this,profile));
}
Program: 180980
Project: 180980
Buggy source:
private boolean connectInt(CachedBluetoothDevice cachedDevice,Profile profile){
  if (!cachedDevice.ensurePaired())   return false;
  LocalBluetoothProfileManager profileManager=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile);
  int status=profileManager.getConnectionStatus(cachedDevice.mDevice);
  if (!SettingsBtStatus.isConnectionStatusConnected(status)) {
    if (profileManager.connect(cachedDevice.mDevice)) {
      return true;
    }
    Log.i(TAG,"String_Node_Str" + profile.toString() + "String_Node_Str"+ cachedDevice.mName);
  }
  Log.i(TAG,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
private boolean connectInt(CachedBluetoothDevice cachedDevice,Profile profile){
  if (!cachedDevice.ensurePaired())   return false;
  LocalBluetoothProfileManager profileManager=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile);
  int status=profileManager.getConnectionStatus(cachedDevice.mDevice);
  if (!SettingsBtStatus.isConnectionStatusConnected(status)) {
    if (profileManager.connect(cachedDevice.mDevice)) {
      return true;
    }
    Log.i(TAG,"String_Node_Str" + profile.toString() + "String_Node_Str"+ cachedDevice.mName);
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  return false;
}
Program: 180981
Project: 180981
Buggy source:
/** 
 * Refreshes the UI when framework alerts us of a UUID change.
 */
public void onUuidChanged(){
  updateProfiles();
  if (DEBUG)   Log.e(TAG,"String_Node_Str" + (SystemClock.elapsedRealtime() - mConnectAttemptedWithoutUuid));
  if (mProfiles.size() > 0 && (mConnectAttemptedWithoutUuid + MAX_UUID_DELAY_FOR_AUTO_CONNECT) > SystemClock.elapsedRealtime()) {
    connect();
  }
  dispatchAttributesChanged();
}

Fixed version (ground truth):
/** 
 * Refreshes the UI when framework alerts us of a UUID change.
 */
public void onUuidChanged(){
  updateProfiles();
  if (DEBUG) {
    Log.e(TAG,"String_Node_Str" + (SystemClock.elapsedRealtime() - mConnectAttempted));
  }
  if (mProfiles.size() > 0 && (mConnectAttempted + MAX_UUID_DELAY_FOR_AUTO_CONNECT) > SystemClock.elapsedRealtime()) {
    connectWithoutResettingTimer();
  }
  dispatchAttributesChanged();
}
Program: 180982
Project: 180982
Buggy source:
public synchronized void onBondingStateChanged(BluetoothDevice device,int bondState){
  CachedBluetoothDevice cachedDevice=findDevice(device);
  if (cachedDevice == null) {
    if (!readPairedDevices()) {
      Log.e(TAG,"String_Node_Str" + device + "String_Node_Str");
    }
    return;
  }
  cachedDevice.refresh();
  if (bondState == BluetoothDevice.BOND_BONDED) {
    cachedDevice.connect();
  }
}

Fixed version (ground truth):
public synchronized void onBondingStateChanged(BluetoothDevice device,int bondState){
  CachedBluetoothDevice cachedDevice=findDevice(device);
  if (cachedDevice == null) {
    if (!readPairedDevices()) {
      Log.e(TAG,"String_Node_Str" + device + "String_Node_Str");
    }
    return;
  }
  cachedDevice.onBondingStateChanged(bondState);
  if (bondState == BluetoothDevice.BOND_BONDED) {
    cachedDevice.connect();
  }
}
Program: 180983
Project: 180983
Buggy source:
private void showCstorDialog(int dialogId){
  mDialogId=dialogId;
  showDialog(dialogId);
}

Fixed version (ground truth):
private void showCstorDialog(int dialogId){
  mDialogId=dialogId;
  mRetry=false;
  showDialog(dialogId);
}
Program: 180984
Project: 180984
Buggy source:
public void onDismiss(DialogInterface dialog){
  if (mRetry) {
    showCstorDialog(mDialogId);
  }
 else {
    removeDialog(mDialogId);
    if (mExternalIntent != null) {
      finish();
    }
  }
}

Fixed version (ground truth):
public void onDismiss(DialogInterface dialog){
  if (mRetry) {
    showCstorDialog(mDialogId);
  }
 else {
    removeDialog(mDialogId);
    updatePreferences(mState);
    if (mExternalIntent != null) {
      finish();
    }
  }
}
Program: 180985
Project: 180985
Buggy source:
@Override protected void onResume(){
  super.onResume();
  boolean patternExists=mLockPatternUtils.savedPatternExists();
  mLockEnabled.setEnabled(patternExists);
  mVisiblePattern.setEnabled(patternExists);
  mTactileFeedback.setEnabled(patternExists);
  mLockEnabled.setChecked(mLockPatternUtils.isLockPatternEnabled());
  mVisiblePattern.setChecked(mLockPatternUtils.isVisiblePatternEnabled());
  mTactileFeedback.setChecked(mLockPatternUtils.isTactileFeedbackEnabled());
  int chooseStringRes=mLockPatternUtils.savedPatternExists() ? R.string.lockpattern_settings_change_lock_pattern : R.string.lockpattern_settings_choose_lock_pattern;
  mChoosePattern.setTitle(chooseStringRes);
  mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.TEXT_SHOW_PASSWORD,1) != 0);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  boolean patternExists=mLockPatternUtils.savedPatternExists();
  mLockEnabled.setEnabled(patternExists);
  mVisiblePattern.setEnabled(patternExists);
  mTactileFeedback.setEnabled(patternExists);
  mLockEnabled.setChecked(mLockPatternUtils.isLockPatternEnabled());
  mVisiblePattern.setChecked(mLockPatternUtils.isVisiblePatternEnabled());
  mTactileFeedback.setChecked(mLockPatternUtils.isTactileFeedbackEnabled());
  int chooseStringRes=mLockPatternUtils.savedPatternExists() ? R.string.lockpattern_settings_change_lock_pattern : R.string.lockpattern_settings_choose_lock_pattern;
  mChoosePattern.setTitle(chooseStringRes);
  mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.TEXT_SHOW_PASSWORD,1) != 0);
  mCstorHelper.resume();
}
Program: 180986
Project: 180986
Buggy source:
private void showCstorDialog(int dialogId){
  mDialogId=dialogId;
  showDialog(dialogId);
}

Fixed version (ground truth):
private void showCstorDialog(int dialogId){
  mDialogId=dialogId;
  mRetry=false;
  showDialog(dialogId);
}
Program: 180987
Project: 180987
Buggy source:
public void onDismiss(DialogInterface dialog){
  if (mRetry) {
    showCstorDialog(mDialogId);
  }
 else {
    removeDialog(mDialogId);
    if (mExternalIntent != null) {
      finish();
    }
  }
}

Fixed version (ground truth):
public void onDismiss(DialogInterface dialog){
  if (mRetry) {
    showCstorDialog(mDialogId);
  }
 else {
    removeDialog(mDialogId);
    updatePreferences(mState);
    if (mExternalIntent != null) {
      finish();
    }
  }
}
Program: 180988
Project: 180988
Buggy source:
@Override protected void onResume(){
  super.onResume();
  boolean patternExists=mLockPatternUtils.savedPatternExists();
  mLockEnabled.setEnabled(patternExists);
  mVisiblePattern.setEnabled(patternExists);
  mTactileFeedback.setEnabled(patternExists);
  mLockEnabled.setChecked(mLockPatternUtils.isLockPatternEnabled());
  mVisiblePattern.setChecked(mLockPatternUtils.isVisiblePatternEnabled());
  mTactileFeedback.setChecked(mLockPatternUtils.isTactileFeedbackEnabled());
  int chooseStringRes=mLockPatternUtils.savedPatternExists() ? R.string.lockpattern_settings_change_lock_pattern : R.string.lockpattern_settings_choose_lock_pattern;
  mChoosePattern.setTitle(chooseStringRes);
  mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.TEXT_SHOW_PASSWORD,1) != 0);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  boolean patternExists=mLockPatternUtils.savedPatternExists();
  mLockEnabled.setEnabled(patternExists);
  mVisiblePattern.setEnabled(patternExists);
  mTactileFeedback.setEnabled(patternExists);
  mLockEnabled.setChecked(mLockPatternUtils.isLockPatternEnabled());
  mVisiblePattern.setChecked(mLockPatternUtils.isVisiblePatternEnabled());
  mTactileFeedback.setChecked(mLockPatternUtils.isTactileFeedbackEnabled());
  int chooseStringRes=mLockPatternUtils.savedPatternExists() ? R.string.lockpattern_settings_change_lock_pattern : R.string.lockpattern_settings_choose_lock_pattern;
  mChoosePattern.setTitle(chooseStringRes);
  mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.TEXT_SHOW_PASSWORD,1) != 0);
  mCstorHelper.resume();
}
Program: 180990
Project: 180990
Buggy source:
private void fetchName(){
  mName=mDevice.getName();
  if (TextUtils.isEmpty(mName)) {
    mName=mDevice.getAddress();
  }
}

Fixed version (ground truth):
private void fetchName(){
  mName=mDevice.getName();
  if (TextUtils.isEmpty(mName)) {
    mName=mDevice.getAddress();
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + mName);
  }
}
Program: 180991
Project: 180991
Buggy source:
public void connect(Profile profile){
  mIsConnectingErrorPossible=true;
  queueCommand(new BluetoothJob(BluetoothCommand.CONNECT,this,profile));
}

Fixed version (ground truth):
public void connect(Profile profile){
  mConnectAttempted=SystemClock.elapsedRealtime();
  mIsConnectingErrorPossible=true;
  queueCommand(new BluetoothJob(BluetoothCommand.CONNECT,this,profile));
}
Program: 180992
Project: 180992
Buggy source:
private boolean connectInt(CachedBluetoothDevice cachedDevice,Profile profile){
  if (!cachedDevice.ensurePaired())   return false;
  LocalBluetoothProfileManager profileManager=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile);
  int status=profileManager.getConnectionStatus(cachedDevice.mDevice);
  if (!SettingsBtStatus.isConnectionStatusConnected(status)) {
    if (profileManager.connect(cachedDevice.mDevice)) {
      return true;
    }
    Log.i(TAG,"String_Node_Str" + profile.toString() + "String_Node_Str"+ cachedDevice.mName);
  }
  Log.i(TAG,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
private boolean connectInt(CachedBluetoothDevice cachedDevice,Profile profile){
  if (!cachedDevice.ensurePaired())   return false;
  LocalBluetoothProfileManager profileManager=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile);
  int status=profileManager.getConnectionStatus(cachedDevice.mDevice);
  if (!SettingsBtStatus.isConnectionStatusConnected(status)) {
    if (profileManager.connect(cachedDevice.mDevice)) {
      return true;
    }
    Log.i(TAG,"String_Node_Str" + profile.toString() + "String_Node_Str"+ cachedDevice.mName);
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  return false;
}
Program: 180993
Project: 180993
Buggy source:
/** 
 * Refreshes the UI when framework alerts us of a UUID change.
 */
public void onUuidChanged(){
  updateProfiles();
  if (DEBUG)   Log.e(TAG,"String_Node_Str" + (SystemClock.elapsedRealtime() - mConnectAttemptedWithoutUuid));
  if (mProfiles.size() > 0 && (mConnectAttemptedWithoutUuid + MAX_UUID_DELAY_FOR_AUTO_CONNECT) > SystemClock.elapsedRealtime()) {
    connect();
  }
  dispatchAttributesChanged();
}

Fixed version (ground truth):
/** 
 * Refreshes the UI when framework alerts us of a UUID change.
 */
public void onUuidChanged(){
  updateProfiles();
  if (DEBUG) {
    Log.e(TAG,"String_Node_Str" + (SystemClock.elapsedRealtime() - mConnectAttempted));
  }
  if (mProfiles.size() > 0 && (mConnectAttempted + MAX_UUID_DELAY_FOR_AUTO_CONNECT) > SystemClock.elapsedRealtime()) {
    connectWithoutResettingTimer();
  }
  dispatchAttributesChanged();
}
Program: 180994
Project: 180994
Buggy source:
public synchronized void onBondingStateChanged(BluetoothDevice device,int bondState){
  CachedBluetoothDevice cachedDevice=findDevice(device);
  if (cachedDevice == null) {
    if (!readPairedDevices()) {
      Log.e(TAG,"String_Node_Str" + device + "String_Node_Str");
    }
    return;
  }
  cachedDevice.refresh();
  if (bondState == BluetoothDevice.BOND_BONDED) {
    cachedDevice.connect();
  }
}

Fixed version (ground truth):
public synchronized void onBondingStateChanged(BluetoothDevice device,int bondState){
  CachedBluetoothDevice cachedDevice=findDevice(device);
  if (cachedDevice == null) {
    if (!readPairedDevices()) {
      Log.e(TAG,"String_Node_Str" + device + "String_Node_Str");
    }
    return;
  }
  cachedDevice.onBondingStateChanged(bondState);
  if (bondState == BluetoothDevice.BOND_BONDED) {
    cachedDevice.connect();
  }
}
Program: 180995
Project: 180995
Buggy source:
private void handleStateChanged(int state){
  if (state == BluetoothAdapter.STATE_OFF || state == BluetoothAdapter.STATE_ON) {
    mCheckBoxPreference.setChecked(state == BluetoothAdapter.STATE_ON);
    mCheckBoxPreference.setSummary(state == BluetoothAdapter.STATE_OFF ? mOriginalSummary : null);
    mCheckBoxPreference.setEnabled(isEnabledByDependency());
  }
 else   if (state == BluetoothAdapter.STATE_TURNING_ON || state == BluetoothAdapter.STATE_TURNING_OFF) {
    mCheckBoxPreference.setSummary(state == BluetoothAdapter.STATE_TURNING_ON ? R.string.wifi_starting : R.string.wifi_stopping);
  }
 else {
    mCheckBoxPreference.setChecked(false);
    mCheckBoxPreference.setSummary(R.string.wifi_error);
    mCheckBoxPreference.setEnabled(true);
  }
}

Fixed version (ground truth):
private void handleStateChanged(int state){
  if (state == BluetoothAdapter.STATE_OFF || state == BluetoothAdapter.STATE_ON) {
    mCheckBoxPreference.setChecked(state == BluetoothAdapter.STATE_ON);
    mCheckBoxPreference.setSummary(state == BluetoothAdapter.STATE_OFF ? mOriginalSummary : null);
    if (isEnabledByDependency()) {
      mCheckBoxPreference.setEnabled(true);
    }
  }
 else   if (state == BluetoothAdapter.STATE_TURNING_ON || state == BluetoothAdapter.STATE_TURNING_OFF) {
    mCheckBoxPreference.setSummary(state == BluetoothAdapter.STATE_TURNING_ON ? R.string.wifi_starting : R.string.wifi_stopping);
  }
 else {
    mCheckBoxPreference.setChecked(false);
    mCheckBoxPreference.setSummary(R.string.wifi_error);
    mCheckBoxPreference.setEnabled(true);
  }
}
Program: 180996
Project: 180996
Buggy source:
public int getBtClassDrawable(){
switch (mBtClass.getMajorDeviceClass()) {
case BluetoothClass.Device.Major.COMPUTER:
    return R.drawable.ic_bt_laptop;
case BluetoothClass.Device.Major.PHONE:
  return R.drawable.ic_bt_cellphone;
}
if (mProfiles.contains(Profile.A2DP)) {
return R.drawable.ic_bt_headphones_a2dp;
}
 else if (mProfiles.contains(Profile.HEADSET)) {
return R.drawable.ic_bt_headset_hfp;
}
 else {
return 0;
}
}

Fixed version (ground truth):
public int getBtClassDrawable(){
switch (mBtClass.getMajorDeviceClass()) {
case BluetoothClass.Device.Major.COMPUTER:
    return R.drawable.ic_bt_laptop;
case BluetoothClass.Device.Major.PHONE:
  return R.drawable.ic_bt_cellphone;
}
if (mProfiles.size() > 0) {
if (mProfiles.contains(Profile.A2DP)) {
  return R.drawable.ic_bt_headphones_a2dp;
}
 else if (mProfiles.contains(Profile.HEADSET)) {
  return R.drawable.ic_bt_headset_hfp;
}
}
 else {
if (mBtClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
  return R.drawable.ic_bt_headphones_a2dp;
}
if (mBtClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET)) {
  return R.drawable.ic_bt_headset_hfp;
}
}
return 0;
}
Program: 180997
Project: 180997
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
    onBluetoothStateChanged(mLocalManager.getBluetoothState());
  }
 else   if (intent.getAction().equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED) && mScreenType == SCREEN_TYPE_DEVICEPICKER) {
    int bondState=intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,BluetoothDevice.ERROR);
    if (bondState == BluetoothDevice.BOND_BONDED) {
      BluetoothDevice device=intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
      sendDevicePickedIntent(device);
      finish();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
    onBluetoothStateChanged(mLocalManager.getBluetoothState());
  }
 else   if (intent.getAction().equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED) && mScreenType == SCREEN_TYPE_DEVICEPICKER) {
    int bondState=intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,BluetoothDevice.ERROR);
    if (bondState == BluetoothDevice.BOND_BONDED) {
      BluetoothDevice device=intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
      if (device.equals(mSelectedDevice)) {
        sendDevicePickedIntent(device);
        finish();
      }
    }
  }
}
Program: 180998
Project: 180998
Buggy source:
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  if (KEY_BT_SCAN.equals(preference.getKey())) {
    mLocalManager.startScanning(true);
    return true;
  }
  if (preference instanceof BluetoothDevicePreference) {
    BluetoothDevicePreference btPreference=(BluetoothDevicePreference)preference;
    if (mScreenType == SCREEN_TYPE_SETTINGS) {
      btPreference.getCachedDevice().onClicked();
    }
 else     if (mScreenType == SCREEN_TYPE_DEVICEPICKER) {
      CachedBluetoothDevice device=btPreference.getCachedDevice();
      if ((device.getBondState() == BluetoothDevice.BOND_BONDED) || (mNeedAuth == false)) {
        BluetoothDevice btAddress=btPreference.getCachedDevice().getDevice();
        sendDevicePickedIntent(btAddress);
        finish();
      }
 else {
        btPreference.getCachedDevice().onClicked();
      }
    }
    return true;
  }
  return super.onPreferenceTreeClick(preferenceScreen,preference);
}

Fixed version (ground truth):
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  if (KEY_BT_SCAN.equals(preference.getKey())) {
    mLocalManager.startScanning(true);
    return true;
  }
  if (preference instanceof BluetoothDevicePreference) {
    BluetoothDevicePreference btPreference=(BluetoothDevicePreference)preference;
    if (mScreenType == SCREEN_TYPE_SETTINGS) {
      btPreference.getCachedDevice().onClicked();
    }
 else     if (mScreenType == SCREEN_TYPE_DEVICEPICKER) {
      CachedBluetoothDevice device=btPreference.getCachedDevice();
      mSelectedDevice=device.getDevice();
      if ((device.getBondState() == BluetoothDevice.BOND_BONDED) || (mNeedAuth == false)) {
        sendDevicePickedIntent(mSelectedDevice);
        finish();
      }
 else {
        btPreference.getCachedDevice().onClicked();
      }
    }
    return true;
  }
  return super.onPreferenceTreeClick(preferenceScreen,preference);
}
Program: 180999
Project: 180999
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.wifi_advanced_settings);
  mUseStaticIpCheckBox=(CheckBoxPreference)findPreference(KEY_USE_STATIC_IP);
  for (int i=0; i < mPreferenceKeys.length; i++) {
    Preference preference=findPreference(mPreferenceKeys[i]);
    preference.setOnPreferenceChangeListener(this);
  }
  initNumChannelsPreference();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.wifi_advanced_settings);
  mUseStaticIpCheckBox=(CheckBoxPreference)findPreference(KEY_USE_STATIC_IP);
  mUseStaticIpCheckBox.setOnPreferenceChangeListener(this);
  for (int i=0; i < mPreferenceKeys.length; i++) {
    Preference preference=findPreference(mPreferenceKeys[i]);
    preference.setOnPreferenceChangeListener(this);
  }
  initNumChannelsPreference();
}
Program: 181000
Project: 181000
Buggy source:
public boolean onPreferenceChange(Preference preference,Object newValue){
  String key=preference.getKey();
  if (key == null)   return true;
  if (key.equals(KEY_NUM_CHANNELS)) {
    try {
      int numChannels=Integer.parseInt((String)newValue);
      WifiManager wifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
      if (!wifiManager.setNumAllowedChannels(numChannels,true)) {
        Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      }
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else   if (key.equals(KEY_SLEEP_POLICY)) {
    try {
      Settings.System.putInt(getContentResolver(),Settings.System.WIFI_SLEEP_POLICY,Integer.parseInt(((String)newValue)));
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_sleep_policy_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else {
    String value=(String)newValue;
    if (!isIpAddress(value)) {
      Toast.makeText(this,R.string.wifi_ip_settings_invalid_ip,Toast.LENGTH_LONG).show();
      return false;
    }
    preference.setSummary(value);
  }
  return true;
}

Fixed version (ground truth):
public boolean onPreferenceChange(Preference preference,Object newValue){
  String key=preference.getKey();
  if (key == null)   return true;
  if (key.equals(KEY_NUM_CHANNELS)) {
    try {
      int numChannels=Integer.parseInt((String)newValue);
      WifiManager wifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
      if (!wifiManager.setNumAllowedChannels(numChannels,true)) {
        Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      }
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else   if (key.equals(KEY_SLEEP_POLICY)) {
    try {
      Settings.System.putInt(getContentResolver(),Settings.System.WIFI_SLEEP_POLICY,Integer.parseInt(((String)newValue)));
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_sleep_policy_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else   if (key.equals(KEY_USE_STATIC_IP)) {
    boolean value=((Boolean)newValue).booleanValue();
    try {
      Settings.System.putInt(getContentResolver(),Settings.System.WIFI_USE_STATIC_IP,value ? 1 : 0);
    }
 catch (    NumberFormatException e) {
      return false;
    }
  }
 else {
    String value=(String)newValue;
    if (!isIpAddress(value)) {
      Toast.makeText(this,R.string.wifi_ip_settings_invalid_ip,Toast.LENGTH_LONG).show();
      return false;
    }
    preference.setSummary(value);
    for (int i=0; i < mSettingNames.length; i++) {
      if (key.equals(mPreferenceKeys[i])) {
        Settings.System.putString(getContentResolver(),mSettingNames[i],value);
        break;
      }
    }
  }
  return true;
}
Program: 181001
Project: 181001
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.wifi_advanced_settings);
  mUseStaticIpCheckBox=(CheckBoxPreference)findPreference(KEY_USE_STATIC_IP);
  for (int i=0; i < mPreferenceKeys.length; i++) {
    Preference preference=findPreference(mPreferenceKeys[i]);
    preference.setOnPreferenceChangeListener(this);
  }
  initNumChannelsPreference();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.wifi_advanced_settings);
  mUseStaticIpCheckBox=(CheckBoxPreference)findPreference(KEY_USE_STATIC_IP);
  mUseStaticIpCheckBox.setOnPreferenceChangeListener(this);
  for (int i=0; i < mPreferenceKeys.length; i++) {
    Preference preference=findPreference(mPreferenceKeys[i]);
    preference.setOnPreferenceChangeListener(this);
  }
  initNumChannelsPreference();
}
Program: 181002
Project: 181002
Buggy source:
public boolean onPreferenceChange(Preference preference,Object newValue){
  String key=preference.getKey();
  if (key == null)   return true;
  if (key.equals(KEY_NUM_CHANNELS)) {
    try {
      int numChannels=Integer.parseInt((String)newValue);
      WifiManager wifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
      if (!wifiManager.setNumAllowedChannels(numChannels,true)) {
        Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      }
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else   if (key.equals(KEY_SLEEP_POLICY)) {
    try {
      Settings.System.putInt(getContentResolver(),Settings.System.WIFI_SLEEP_POLICY,Integer.parseInt(((String)newValue)));
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_sleep_policy_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else {
    String value=(String)newValue;
    if (!isIpAddress(value)) {
      Toast.makeText(this,R.string.wifi_ip_settings_invalid_ip,Toast.LENGTH_LONG).show();
      return false;
    }
    preference.setSummary(value);
  }
  return true;
}

Fixed version (ground truth):
public boolean onPreferenceChange(Preference preference,Object newValue){
  String key=preference.getKey();
  if (key == null)   return true;
  if (key.equals(KEY_NUM_CHANNELS)) {
    try {
      int numChannels=Integer.parseInt((String)newValue);
      WifiManager wifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
      if (!wifiManager.setNumAllowedChannels(numChannels,true)) {
        Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      }
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else   if (key.equals(KEY_SLEEP_POLICY)) {
    try {
      Settings.System.putInt(getContentResolver(),Settings.System.WIFI_SLEEP_POLICY,Integer.parseInt(((String)newValue)));
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_sleep_policy_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else   if (key.equals(KEY_USE_STATIC_IP)) {
    boolean value=((Boolean)newValue).booleanValue();
    try {
      Settings.System.putInt(getContentResolver(),Settings.System.WIFI_USE_STATIC_IP,value ? 1 : 0);
    }
 catch (    NumberFormatException e) {
      return false;
    }
  }
 else {
    String value=(String)newValue;
    if (!isIpAddress(value)) {
      Toast.makeText(this,R.string.wifi_ip_settings_invalid_ip,Toast.LENGTH_LONG).show();
      return false;
    }
    preference.setSummary(value);
    for (int i=0; i < mSettingNames.length; i++) {
      if (key.equals(mPreferenceKeys[i])) {
        Settings.System.putString(getContentResolver(),mSettingNames[i],value);
        break;
      }
    }
  }
  return true;
}
Program: 181003
Project: 181003
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.wifi_advanced_settings);
  mUseStaticIpCheckBox=(CheckBoxPreference)findPreference(KEY_USE_STATIC_IP);
  for (int i=0; i < mPreferenceKeys.length; i++) {
    Preference preference=findPreference(mPreferenceKeys[i]);
    preference.setOnPreferenceChangeListener(this);
  }
  initNumChannelsPreference();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.wifi_advanced_settings);
  mUseStaticIpCheckBox=(CheckBoxPreference)findPreference(KEY_USE_STATIC_IP);
  mUseStaticIpCheckBox.setOnPreferenceChangeListener(this);
  for (int i=0; i < mPreferenceKeys.length; i++) {
    Preference preference=findPreference(mPreferenceKeys[i]);
    preference.setOnPreferenceChangeListener(this);
  }
  initNumChannelsPreference();
}
Program: 181004
Project: 181004
Buggy source:
public boolean onPreferenceChange(Preference preference,Object newValue){
  String key=preference.getKey();
  if (key == null)   return true;
  if (key.equals(KEY_NUM_CHANNELS)) {
    try {
      int numChannels=Integer.parseInt((String)newValue);
      WifiManager wifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
      if (!wifiManager.setNumAllowedChannels(numChannels,true)) {
        Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      }
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else   if (key.equals(KEY_SLEEP_POLICY)) {
    try {
      Settings.System.putInt(getContentResolver(),Settings.System.WIFI_SLEEP_POLICY,Integer.parseInt(((String)newValue)));
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_sleep_policy_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else {
    String value=(String)newValue;
    if (!isIpAddress(value)) {
      Toast.makeText(this,R.string.wifi_ip_settings_invalid_ip,Toast.LENGTH_LONG).show();
      return false;
    }
    preference.setSummary(value);
  }
  return true;
}

Fixed version (ground truth):
public boolean onPreferenceChange(Preference preference,Object newValue){
  String key=preference.getKey();
  if (key == null)   return true;
  if (key.equals(KEY_NUM_CHANNELS)) {
    try {
      int numChannels=Integer.parseInt((String)newValue);
      WifiManager wifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
      if (!wifiManager.setNumAllowedChannels(numChannels,true)) {
        Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      }
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_num_channels_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else   if (key.equals(KEY_SLEEP_POLICY)) {
    try {
      Settings.System.putInt(getContentResolver(),Settings.System.WIFI_SLEEP_POLICY,Integer.parseInt(((String)newValue)));
    }
 catch (    NumberFormatException e) {
      Toast.makeText(this,R.string.wifi_setting_sleep_policy_error,Toast.LENGTH_SHORT).show();
      return false;
    }
  }
 else   if (key.equals(KEY_USE_STATIC_IP)) {
    boolean value=((Boolean)newValue).booleanValue();
    try {
      Settings.System.putInt(getContentResolver(),Settings.System.WIFI_USE_STATIC_IP,value ? 1 : 0);
    }
 catch (    NumberFormatException e) {
      return false;
    }
  }
 else {
    String value=(String)newValue;
    if (!isIpAddress(value)) {
      Toast.makeText(this,R.string.wifi_ip_settings_invalid_ip,Toast.LENGTH_LONG).show();
      return false;
    }
    preference.setSummary(value);
    for (int i=0; i < mSettingNames.length; i++) {
      if (key.equals(mPreferenceKeys[i])) {
        Settings.System.putString(getContentResolver(),mSettingNames[i],value);
        break;
      }
    }
  }
  return true;
}
Program: 181005
Project: 181005
Buggy source:
public void updatePackage(String pkgName,long size,String formattedSize){
  ApplicationInfo info=null;
  try {
    info=mPm.getApplicationInfo(pkgName,PackageManager.GET_UNINSTALLED_PACKAGES);
  }
 catch (  NameNotFoundException e) {
    return;
  }
  AppInfo aInfo=mCache.getEntry(pkgName);
  if (aInfo != null) {
    aInfo.refreshLabel(info.loadLabel(mPm));
    aInfo.refreshIcon(info.loadIcon(mPm));
    aInfo.setSize(size,formattedSize);
    notifyDataSetChanged();
  }
}

Fixed version (ground truth):
public void updatePackage(String pkgName,long size,String formattedSize){
  ApplicationInfo info=null;
  try {
    info=mPm.getApplicationInfo(pkgName,PackageManager.GET_UNINSTALLED_PACKAGES);
  }
 catch (  NameNotFoundException e) {
    return;
  }
  AppInfo aInfo=mCache.getEntry(pkgName);
  if (aInfo != null) {
    CharSequence label=info.loadLabel(mPm);
    aInfo.refreshLabel(label);
    aInfo.refreshIcon(info.loadIcon(mPm));
    aInfo.setSize(size,formattedSize);
    addLocalEntry(info,label);
    notifyDataSetChanged();
  }
}
Program: 181006
Project: 181006
Buggy source:
private boolean updateAppList(List<ApplicationInfo> newList){
  if ((newList == null) || mCache.isEmpty()) {
    return false;
  }
  Set<String> existingList=new HashSet<String>();
  boolean ret=false;
  for (  ApplicationInfo info : newList) {
    String pkgName=info.packageName;
    AppInfo aInfo=mCache.getEntry(pkgName);
    if (aInfo != null) {
      existingList.add(pkgName);
    }
 else {
      if (localLOGV)       Log.i(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      updatePackageList(Intent.ACTION_PACKAGE_ADDED,pkgName);
      ret=true;
    }
  }
  List<String> deletedList=null;
  Set<String> staleList=mCache.getPkgList();
  for (  String pkgName : staleList) {
    if (!existingList.contains(pkgName)) {
      if (localLOGV)       Log.i(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      if (deletedList == null) {
        deletedList=new ArrayList<String>();
        deletedList.add(pkgName);
      }
      ret=true;
    }
  }
  if (deletedList != null) {
    mAppInfoAdapter.removeFromList(deletedList);
  }
  return ret;
}

Fixed version (ground truth):
private boolean updateAppList(List<ApplicationInfo> newList){
  if ((newList == null) || mCache.isEmpty()) {
    return false;
  }
  Set<String> existingList=new HashSet<String>();
  boolean ret=false;
  int N=newList.size();
  for (int i=(N - 1); i >= 0; i--) {
    ApplicationInfo info=newList.get(i);
    String pkgName=info.packageName;
    AppInfo aInfo=mCache.getEntry(pkgName);
    if (aInfo != null) {
      existingList.add(pkgName);
    }
 else {
      if (localLOGV)       Log.i(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      updatePackageList(Intent.ACTION_PACKAGE_ADDED,pkgName);
      newList.remove(i);
      ret=true;
    }
  }
  List<String> deletedList=null;
  Set<String> staleList=mCache.getPkgList();
  for (  String pkgName : staleList) {
    if (!existingList.contains(pkgName)) {
      if (localLOGV)       Log.i(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      if (deletedList == null) {
        deletedList=new ArrayList<String>();
        deletedList.add(pkgName);
      }
      ret=true;
    }
  }
  if (deletedList != null) {
    if (localLOGV)     Log.i(TAG,"String_Node_Str");
    mAppInfoAdapter.removeFromList(deletedList);
  }
  return ret;
}
Program: 181007
Project: 181007
Buggy source:
public void addToList(String pkgName,long size,String formattedSize){
  if (pkgName == null) {
    return;
  }
  boolean notInList=true;
  ApplicationInfo info=null;
  try {
    info=mPm.getApplicationInfo(pkgName,0);
  }
 catch (  NameNotFoundException e) {
    Log.w(TAG,"String_Node_Str" + pkgName);
    return;
  }
  if (info == null) {
    Log.i(TAG,"String_Node_Str" + pkgName);
    return;
  }
  mAppList.add(info);
  CharSequence label=info.loadLabel(mPm);
  mCache.addEntry(new AppInfo(pkgName,-1,label,info.loadIcon(mPm),size,formattedSize));
  if (notInList && (shouldBeInList(mFilterApps,info))) {
    int newIdx=Collections.binarySearch(mAppLocalList,info,getAppComparator(mSortOrder));
    if (newIdx >= 0) {
      Log.i(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      return;
    }
    newIdx=-newIdx - 1;
    addFilterListLocked(newIdx,info,label);
    adjustIndex();
    notifyDataSetChanged();
  }
}

Fixed version (ground truth):
public void addToList(String pkgName,long size,String formattedSize){
  if (pkgName == null) {
    return;
  }
  ApplicationInfo info=null;
  try {
    info=mPm.getApplicationInfo(pkgName,0);
  }
 catch (  NameNotFoundException e) {
    Log.w(TAG,"String_Node_Str" + pkgName);
    return;
  }
  if (info == null) {
    Log.i(TAG,"String_Node_Str" + pkgName);
    return;
  }
  mAppList.add(info);
  CharSequence label=info.loadLabel(mPm);
  mCache.addEntry(new AppInfo(pkgName,-1,label,info.loadIcon(mPm),size,formattedSize));
  if (addLocalEntry(info,label)) {
    notifyDataSetChanged();
  }
}
Program: 181009
Project: 181009
Buggy source:
/** 
 * Ask the current default engine to launch the matching INSTALL_TTS_DATA activity so the required TTS files are properly installed.
 */
private void installVoiceData(){
  PackageManager pm=getPackageManager();
  Intent intent=new Intent();
  intent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
  List<ResolveInfo> resolveInfos=pm.queryIntentActivities(intent,0);
  for (int i=0; i < resolveInfos.size(); i++) {
    ActivityInfo currentActivityInfo=resolveInfos.get(i).activityInfo;
    if (mDefaultEng.equals(currentActivityInfo.packageName)) {
      intent.setClassName(mDefaultEng,currentActivityInfo.name);
      this.startActivityForResult(intent,VOICE_DATA_INSTALLATION);
    }
  }
}

Fixed version (ground truth):
/** 
 * Ask the current default engine to launch the matching INSTALL_TTS_DATA activity so the required TTS files are properly installed.
 */
private void installVoiceData(){
  PackageManager pm=getPackageManager();
  Intent intent=new Intent();
  intent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  List<ResolveInfo> resolveInfos=pm.queryIntentActivities(intent,0);
  for (int i=0; i < resolveInfos.size(); i++) {
    ActivityInfo currentActivityInfo=resolveInfos.get(i).activityInfo;
    if (mDefaultEng.equals(currentActivityInfo.packageName)) {
      intent.setClassName(mDefaultEng,currentActivityInfo.name);
      this.startActivity(intent);
    }
  }
}