nus-yam/ex-repair huggingface dataset:
Program: 181010
Project: 181010
Buggy source:
@Override protected void onResume(){
  super.onResume();
  mWifiEnabler.resume();
  mAirplaneModeEnabler.resume();
  mBtEnabler.resume();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mWifiEnabler.resume();
  mBtEnabler.resume();
  mAirplaneModeEnabler.resume();
}
Program: 181011
Project: 181011
Buggy source:
/** 
 * Sets the state of the preferences for enabling/disabling AccessibilityServices.
 * @param isEnabled If to enable or disable the preferences.
 */
private void setAccessibilityServicePreferencesState(boolean isEnabled){
  if (mAccessibilityServicesCategory == null) {
    return;
  }
  int count=mAccessibilityServicesCategory.getPreferenceCount();
  for (int i=0; i < count; i++) {
    mAccessibilityServicesCategory.getPreference(i).setEnabled(isEnabled);
  }
}

Fixed version (ground truth):
/** 
 * Sets the state of the preferences for enabling/disabling AccessibilityServices.
 * @param isEnabled If to enable or disable the preferences.
 */
private void setAccessibilityServicePreferencesState(boolean isEnabled){
  if (mAccessibilityServicesCategory == null) {
    return;
  }
  int count=mAccessibilityServicesCategory.getPreferenceCount();
  for (int i=0; i < count; i++) {
    Preference pref=mAccessibilityServicesCategory.getPreference(i);
    pref.setEnabled(isEnabled);
    if (!isEnabled) {
      ((CheckBoxPreference)pref).setChecked(false);
    }
  }
}
Program: 181012
Project: 181012
Buggy source:
@Override protected void onResume(){
  super.onResume();
  mDevicePreferenceMap.clear();
  mDeviceList.removeAll();
  addDevices();
  mEnabler.resume();
  mDiscoverableEnabler.resume();
  mNamePreference.resume();
  mLocalManager.registerCallback(this);
  mLocalManager.startScanning(false);
  registerReceiver(mReceiver,new IntentFilter(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION));
  mLocalManager.setForegroundActivity(this);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mDevicePreferenceMap.clear();
  mDeviceList.removeAll();
  addDevices();
  mEnabler.resume();
  mDiscoverableEnabler.resume();
  mNamePreference.resume();
  mLocalManager.registerCallback(this);
  mDeviceList.setProgress(mLocalManager.getBluetoothManager().isDiscovering());
  mLocalManager.startScanning(false);
  registerReceiver(mReceiver,new IntentFilter(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION));
  mLocalManager.setForegroundActivity(this);
}
Program: 181013
Project: 181013
Buggy source:
@Override public boolean isEnabled(){
  return super.isEnabled() && !mIsBusy;
}

Fixed version (ground truth):
@Override public boolean isEnabled(){
  setEnabled(true);
  return super.isEnabled() && !mIsBusy;
}
Program: 181014
Project: 181014
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.tts_settings);
  mEnableDemo=false;
  initClickers();
  initDefaultSettings();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.tts_settings);
  setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
  mEnableDemo=false;
  initClickers();
  initDefaultSettings();
}
Program: 181015
Project: 181015
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.tts_settings);
  mEnableDemo=false;
  initClickers();
  initDefaultSettings();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.tts_settings);
  setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
  mEnableDemo=false;
  initClickers();
  initDefaultSettings();
}
Program: 181016
Project: 181016
Buggy source:
@Override public boolean isEnabled(){
  return super.isEnabled() && !mIsBusy;
}

Fixed version (ground truth):
@Override public boolean isEnabled(){
  setEnabled(true);
  return super.isEnabled() && !mIsBusy;
}
Program: 181017
Project: 181017
Buggy source:
/** 
 * Called when we need to set our member variables to point to the views. 
 */
private void onReferenceViews(View view){
  mPasswordText=(TextView)view.findViewById(R.id.password_text);
  mPasswordEdit=(EditText)view.findViewById(R.id.password_edit);
  mSsidText=(TextView)view.findViewById(R.id.ssid_text);
  mSsidEdit=(EditText)view.findViewById(R.id.ssid_edit);
  mSecurityText=(TextView)view.findViewById(R.id.security_text);
  mSecuritySpinner=(Spinner)view.findViewById(R.id.security_spinner);
  mWepTypeSpinner=(Spinner)view.findViewById(R.id.wep_type_spinner);
  mEnterpriseView=mView.findViewById(R.id.enterprise_wrapper);
  mShowPasswordCheckBox=(CheckBox)view.findViewById(R.id.show_password_checkbox);
  if (mShowPasswordCheckBox != null) {
    mShowPasswordCheckBox.setOnClickListener(this);
  }
  if (mMode == MODE_CONFIGURE) {
    mSecuritySpinner.setOnItemSelectedListener(this);
    mSecuritySpinner.setPromptId(R.string.security);
    setSpinnerAdapter(mSecuritySpinner,mAutoSecurityAllowed ? R.array.wifi_security_entries : R.array.wifi_security_without_auto_entries);
  }
 else   if (mMode == MODE_INFO) {
    mTable=(ViewGroup)view.findViewById(R.id.table);
  }
  if (mMode == MODE_CONFIGURE || (mState.isEnterprise() && !mState.configured)) {
    setEnterpriseFields(view);
    mPhase2Spinner.setSelection(getSelectionIndex(R.array.wifi_phase2_entries,mState.getPhase2()));
    mEapSpinner.setSelection(getSelectionIndex(R.array.wifi_eap_entries,mState.getEap()));
    mClientCertSpinner.setSelection(getSelectionIndex(getAllUserCertificateKeys(),mState.getEnterpriseField(AccessPointState.CLIENT_CERT)));
    mCaCertSpinner.setSelection(getSelectionIndex(getAllCaCertificateKeys(),mState.getEnterpriseField(AccessPointState.CA_CERT)));
  }
}

Fixed version (ground truth):
/** 
 * Called when we need to set our member variables to point to the views. 
 */
private void onReferenceViews(View view){
  mPasswordText=(TextView)view.findViewById(R.id.password_text);
  mPasswordEdit=(EditText)view.findViewById(R.id.password_edit);
  mSsidText=(TextView)view.findViewById(R.id.ssid_text);
  mSsidEdit=(EditText)view.findViewById(R.id.ssid_edit);
  mSecurityText=(TextView)view.findViewById(R.id.security_text);
  mSecuritySpinner=(Spinner)view.findViewById(R.id.security_spinner);
  mWepTypeSpinner=(Spinner)view.findViewById(R.id.wep_type_spinner);
  mEnterpriseView=mView.findViewById(R.id.enterprise_wrapper);
  mShowPasswordCheckBox=(CheckBox)view.findViewById(R.id.show_password_checkbox);
  if (mShowPasswordCheckBox != null) {
    mShowPasswordCheckBox.setOnClickListener(this);
  }
  if (mMode == MODE_CONFIGURE) {
    mSecuritySpinner.setOnItemSelectedListener(this);
    mSecuritySpinner.setPromptId(R.string.security);
    setSpinnerAdapter(mSecuritySpinner,mAutoSecurityAllowed ? R.array.wifi_security_entries : R.array.wifi_security_without_auto_entries);
  }
 else   if (mMode == MODE_INFO) {
    mTable=(ViewGroup)view.findViewById(R.id.table);
  }
  if (mMode == MODE_CONFIGURE || (mState.isEnterprise() && !mState.configured)) {
    setEnterpriseFields(view);
    updateCertificateSelection();
  }
}
Program: 181018
Project: 181018
Buggy source:
private void handleSecurityChange(int security){
  setEnterpriseFieldsVisible(false);
switch (security) {
case SECURITY_NONE:
{
      setWepVisible(false);
      setGenericPasswordVisible(false);
      break;
    }
case SECURITY_WEP:
{
    setGenericPasswordVisible(false);
    setWepVisible(true);
    updatePasswordCaption(AccessPointState.WEP);
    break;
  }
case SECURITY_AUTO:
{
  setWepVisible(false);
  setGenericPasswordVisible(mState.hasSecurity());
  updatePasswordCaption(AccessPointState.WPA);
  break;
}
case SECURITY_WPA_PERSONAL:
case SECURITY_WPA2_PERSONAL:
{
setWepVisible(false);
setGenericPasswordVisible(true);
updatePasswordCaption(AccessPointState.WPA);
break;
}
case SECURITY_WPA_EAP:
case SECURITY_IEEE8021X:
{
if (Keystore.getInstance().getState() != Keystore.UNLOCKED) {
getContext().startActivity(new Intent(SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
mSecuritySpinner.setSelection(0);
return;
}
setEnterpriseFieldsVisible(true);
setGenericPasswordVisible(true);
updatePasswordCaption(AccessPointState.WPA);
break;
}
}
}

Fixed version (ground truth):
private void handleSecurityChange(int security){
  setEnterpriseFieldsVisible(false);
switch (security) {
case SECURITY_NONE:
{
      setWepVisible(false);
      setGenericPasswordVisible(false);
      break;
    }
case SECURITY_WEP:
{
    setGenericPasswordVisible(false);
    setWepVisible(true);
    updatePasswordCaption(AccessPointState.WEP);
    break;
  }
case SECURITY_AUTO:
{
  setWepVisible(false);
  setGenericPasswordVisible(mState.hasSecurity());
  updatePasswordCaption(AccessPointState.WPA);
  break;
}
case SECURITY_WPA_PERSONAL:
case SECURITY_WPA2_PERSONAL:
{
setWepVisible(false);
setGenericPasswordVisible(true);
updatePasswordCaption(AccessPointState.WPA);
break;
}
case SECURITY_WPA_EAP:
case SECURITY_IEEE8021X:
{
if (Keystore.getInstance().getState() != Keystore.UNLOCKED) {
getContext().startActivity(new Intent(SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
return;
}
enableEnterpriseFields();
break;
}
}
}
Program: 181019
Project: 181019
Buggy source:
private void showAddOtherNetworkDialog(){
  AccessPointDialog dialog=new AccessPointDialog(this,mWifiLayer);
  dialog.setState(new AccessPointState(this));
  dialog.setMode(AccessPointDialog.MODE_CONFIGURE);
  dialog.setTitle(R.string.wifi_add_other_network);
  dialog.setAutoSecurityAllowed(false);
  showDialog(dialog);
}

Fixed version (ground truth):
private void showAddOtherNetworkDialog(){
  AccessPointDialog dialog=new AccessPointDialog(this,mWifiLayer);
  dialog.setState(new AccessPointState(this));
  dialog.setMode(AccessPointDialog.MODE_CONFIGURE);
  dialog.setTitle(R.string.wifi_add_other_network);
  dialog.setAutoSecurityAllowed(false);
  mResumeMode=AccessPointDialog.MODE_CONFIGURE;
  showDialog(dialog);
}
Program: 181020
Project: 181020
Buggy source:
public void showAccessPointDialog(AccessPointState state,int mode){
  if (state.isEnterprise() && Keystore.getInstance().getState() != Keystore.UNLOCKED) {
    startActivity(new Intent(SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
    return;
  }
  AccessPointDialog dialog=new AccessPointDialog(this,mWifiLayer);
  dialog.setMode(mode);
  dialog.setState(state);
  showDialog(dialog);
}

Fixed version (ground truth):
public void showAccessPointDialog(AccessPointState state,int mode){
  if (state.isEnterprise() && Keystore.getInstance().getState() != Keystore.UNLOCKED) {
    startActivity(new Intent(SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
    mResumeState=state;
    mResumeMode=mode;
    return;
  }
  AccessPointDialog dialog=new AccessPointDialog(this,mWifiLayer);
  dialog.setMode(mode);
  dialog.setState(state);
  showDialog(dialog);
}
Program: 181021
Project: 181021
Buggy source:
/** 
 * {@inheritDoc}
 */
public void onDismiss(DialogInterface dialog){
  if (dialog == mDialog) {
    mDialog=null;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void onDismiss(DialogInterface dialog){
  if (dialog == mDialog) {
    mDialog=null;
    mResumeMode=-1;
  }
}
Program: 181022
Project: 181022
Buggy source:
@Override protected void onResume(){
  super.onResume();
  mWifiLayer.onResume();
  mWifiEnabler.resume();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mWifiLayer.onResume();
  mWifiEnabler.resume();
  if (mResumeState != null) {
    if (Keystore.getInstance().getState() == Keystore.UNLOCKED) {
      showAccessPointDialog(mResumeState,mResumeMode);
    }
    mResumeMode=-1;
    mResumeState=null;
  }
 else {
    if (mResumeMode == AccessPointDialog.MODE_CONFIGURE) {
      if (Keystore.getInstance().getState() == Keystore.UNLOCKED) {
        ((AccessPointDialog)mDialog).enableEnterpriseFields();
      }
    }
  }
}
Program: 181023
Project: 181023
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("String_Node_Str");
  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);
  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);
    }
  }
}
Program: 181024
Project: 181024
Buggy source:
/** 
 * Ask the current default engine to launch the matching CHECK_TTS_DATA activity to check the required TTS files are properly installed.
 */
private void checkVoiceData(){
  PackageManager pm=getPackageManager();
  Intent intent=new Intent();
  intent.setAction("String_Node_Str");
  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_INTEGRITY_CHECK);
    }
  }
}

Fixed version (ground truth):
/** 
 * Ask the current default engine to launch the matching CHECK_TTS_DATA activity to check the required TTS files are properly installed.
 */
private void checkVoiceData(){
  PackageManager pm=getPackageManager();
  Intent intent=new Intent();
  intent.setAction(TextToSpeech.Engine.ACTION_CHECK_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_INTEGRITY_CHECK);
    }
  }
}
Program: 181025
Project: 181025
Buggy source:
/** 
 * Called when the TTS engine is initialized.
 */
public void onInit(int status){
  if (status == TextToSpeech.TTS_SUCCESS) {
    Log.v(TAG,"String_Node_Str");
    mEnableDemo=true;
  }
 else {
    Log.v(TAG,"String_Node_Str");
    mEnableDemo=false;
  }
  updateWidgetState();
}

Fixed version (ground truth):
/** 
 * Called when the TTS engine is initialized.
 */
public void onInit(int status){
  if (status == TextToSpeech.SUCCESS) {
    Log.v(TAG,"String_Node_Str");
    mEnableDemo=true;
  }
 else {
    Log.v(TAG,"String_Node_Str");
    mEnableDemo=false;
  }
  updateWidgetState();
}
Program: 181026
Project: 181026
Buggy source:
/** 
 * Called when mPlayExample or mInstallData is clicked
 */
public boolean onPreferenceClick(Preference preference){
  if (preference == mPlayExample) {
    if (mTts != null) {
      mTts.speak(getResources().getString(R.string.tts_demo),TextToSpeech.TTS_QUEUE_FLUSH,null);
    }
    return true;
  }
  if (preference == mInstallData) {
    installVoiceData();
    finish();
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Called when mPlayExample or mInstallData is clicked
 */
public boolean onPreferenceClick(Preference preference){
  if (preference == mPlayExample) {
    if (mTts != null) {
      mTts.speak(getResources().getString(R.string.tts_demo),TextToSpeech.QUEUE_FLUSH,null);
    }
    return true;
  }
  if (preference == mInstallData) {
    installVoiceData();
    finish();
    return true;
  }
  return false;
}
Program: 181028
Project: 181028
Buggy source:
/** 
 * Called when we need to set our member variables to point to the views. 
 */
private void onReferenceViews(View view){
  mPasswordText=(TextView)view.findViewById(R.id.password_text);
  mPasswordEdit=(EditText)view.findViewById(R.id.password_edit);
  mSsidText=(TextView)view.findViewById(R.id.ssid_text);
  mSsidEdit=(EditText)view.findViewById(R.id.ssid_edit);
  mSecurityText=(TextView)view.findViewById(R.id.security_text);
  mSecuritySpinner=(Spinner)view.findViewById(R.id.security_spinner);
  mWepTypeSpinner=(Spinner)view.findViewById(R.id.wep_type_spinner);
  mEnterpriseView=mView.findViewById(R.id.enterprise_wrapper);
  mShowPasswordCheckBox=(CheckBox)view.findViewById(R.id.show_password_checkbox);
  if (mShowPasswordCheckBox != null) {
    mShowPasswordCheckBox.setOnClickListener(this);
  }
  if (mMode == MODE_CONFIGURE) {
    mSecuritySpinner.setOnItemSelectedListener(this);
    mSecuritySpinner.setPromptId(R.string.security);
    setSpinnerAdapter(mSecuritySpinner,mAutoSecurityAllowed ? R.array.wifi_security_entries : R.array.wifi_security_without_auto_entries);
  }
 else   if (mMode == MODE_INFO) {
    mTable=(ViewGroup)view.findViewById(R.id.table);
  }
  if (mMode == MODE_CONFIGURE || (mState.isEnterprise() && !mState.configured)) {
    setEnterpriseFields(view);
    mPhase2Spinner.setSelection(getSelectionIndex(R.array.wifi_phase2_entries,mState.getPhase2()));
    mEapSpinner.setSelection(getSelectionIndex(R.array.wifi_eap_entries,mState.getEap()));
    mClientCertSpinner.setSelection(getSelectionIndex(getAllUserCertificateKeys(),mState.getEnterpriseField(AccessPointState.CLIENT_CERT)));
    mCaCertSpinner.setSelection(getSelectionIndex(getAllCaCertificateKeys(),mState.getEnterpriseField(AccessPointState.CA_CERT)));
  }
}

Fixed version (ground truth):
/** 
 * Called when we need to set our member variables to point to the views. 
 */
private void onReferenceViews(View view){
  mPasswordText=(TextView)view.findViewById(R.id.password_text);
  mPasswordEdit=(EditText)view.findViewById(R.id.password_edit);
  mSsidText=(TextView)view.findViewById(R.id.ssid_text);
  mSsidEdit=(EditText)view.findViewById(R.id.ssid_edit);
  mSecurityText=(TextView)view.findViewById(R.id.security_text);
  mSecuritySpinner=(Spinner)view.findViewById(R.id.security_spinner);
  mWepTypeSpinner=(Spinner)view.findViewById(R.id.wep_type_spinner);
  mEnterpriseView=mView.findViewById(R.id.enterprise_wrapper);
  mShowPasswordCheckBox=(CheckBox)view.findViewById(R.id.show_password_checkbox);
  if (mShowPasswordCheckBox != null) {
    mShowPasswordCheckBox.setOnClickListener(this);
  }
  if (mMode == MODE_CONFIGURE) {
    mSecuritySpinner.setOnItemSelectedListener(this);
    mSecuritySpinner.setPromptId(R.string.security);
    setSpinnerAdapter(mSecuritySpinner,mAutoSecurityAllowed ? R.array.wifi_security_entries : R.array.wifi_security_without_auto_entries);
  }
 else   if (mMode == MODE_INFO) {
    mTable=(ViewGroup)view.findViewById(R.id.table);
  }
  if (mMode == MODE_CONFIGURE || (mState.isEnterprise() && !mState.configured)) {
    setEnterpriseFields(view);
    updateCertificateSelection();
  }
}
Program: 181029
Project: 181029
Buggy source:
private void handleSecurityChange(int security){
  setEnterpriseFieldsVisible(false);
switch (security) {
case SECURITY_NONE:
{
      setWepVisible(false);
      setGenericPasswordVisible(false);
      break;
    }
case SECURITY_WEP:
{
    setGenericPasswordVisible(false);
    setWepVisible(true);
    updatePasswordCaption(AccessPointState.WEP);
    break;
  }
case SECURITY_AUTO:
{
  setWepVisible(false);
  setGenericPasswordVisible(mState.hasSecurity());
  updatePasswordCaption(AccessPointState.WPA);
  break;
}
case SECURITY_WPA_PERSONAL:
case SECURITY_WPA2_PERSONAL:
{
setWepVisible(false);
setGenericPasswordVisible(true);
updatePasswordCaption(AccessPointState.WPA);
break;
}
case SECURITY_WPA_EAP:
case SECURITY_IEEE8021X:
{
if (Keystore.getInstance().getState() != Keystore.UNLOCKED) {
getContext().startActivity(new Intent(SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
mSecuritySpinner.setSelection(0);
return;
}
setEnterpriseFieldsVisible(true);
setGenericPasswordVisible(true);
updatePasswordCaption(AccessPointState.WPA);
break;
}
}
}

Fixed version (ground truth):
private void handleSecurityChange(int security){
  setEnterpriseFieldsVisible(false);
switch (security) {
case SECURITY_NONE:
{
      setWepVisible(false);
      setGenericPasswordVisible(false);
      break;
    }
case SECURITY_WEP:
{
    setGenericPasswordVisible(false);
    setWepVisible(true);
    updatePasswordCaption(AccessPointState.WEP);
    break;
  }
case SECURITY_AUTO:
{
  setWepVisible(false);
  setGenericPasswordVisible(mState.hasSecurity());
  updatePasswordCaption(AccessPointState.WPA);
  break;
}
case SECURITY_WPA_PERSONAL:
case SECURITY_WPA2_PERSONAL:
{
setWepVisible(false);
setGenericPasswordVisible(true);
updatePasswordCaption(AccessPointState.WPA);
break;
}
case SECURITY_WPA_EAP:
case SECURITY_IEEE8021X:
{
if (Keystore.getInstance().getState() != Keystore.UNLOCKED) {
getContext().startActivity(new Intent(SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
return;
}
enableEnterpriseFields();
break;
}
}
}
Program: 181030
Project: 181030
Buggy source:
private void showAddOtherNetworkDialog(){
  AccessPointDialog dialog=new AccessPointDialog(this,mWifiLayer);
  dialog.setState(new AccessPointState(this));
  dialog.setMode(AccessPointDialog.MODE_CONFIGURE);
  dialog.setTitle(R.string.wifi_add_other_network);
  dialog.setAutoSecurityAllowed(false);
  showDialog(dialog);
}

Fixed version (ground truth):
private void showAddOtherNetworkDialog(){
  AccessPointDialog dialog=new AccessPointDialog(this,mWifiLayer);
  dialog.setState(new AccessPointState(this));
  dialog.setMode(AccessPointDialog.MODE_CONFIGURE);
  dialog.setTitle(R.string.wifi_add_other_network);
  dialog.setAutoSecurityAllowed(false);
  mResumeMode=AccessPointDialog.MODE_CONFIGURE;
  showDialog(dialog);
}
Program: 181031
Project: 181031
Buggy source:
public void showAccessPointDialog(AccessPointState state,int mode){
  if (state.isEnterprise() && Keystore.getInstance().getState() != Keystore.UNLOCKED) {
    startActivity(new Intent(SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
    return;
  }
  AccessPointDialog dialog=new AccessPointDialog(this,mWifiLayer);
  dialog.setMode(mode);
  dialog.setState(state);
  showDialog(dialog);
}

Fixed version (ground truth):
public void showAccessPointDialog(AccessPointState state,int mode){
  if (state.isEnterprise() && Keystore.getInstance().getState() != Keystore.UNLOCKED) {
    startActivity(new Intent(SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
    mResumeState=state;
    mResumeMode=mode;
    return;
  }
  AccessPointDialog dialog=new AccessPointDialog(this,mWifiLayer);
  dialog.setMode(mode);
  dialog.setState(state);
  showDialog(dialog);
}
Program: 181032
Project: 181032
Buggy source:
/** 
 * {@inheritDoc}
 */
public void onDismiss(DialogInterface dialog){
  if (dialog == mDialog) {
    mDialog=null;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void onDismiss(DialogInterface dialog){
  if (dialog == mDialog) {
    mDialog=null;
    mResumeMode=-1;
  }
}
Program: 181033
Project: 181033
Buggy source:
@Override protected void onResume(){
  super.onResume();
  mWifiLayer.onResume();
  mWifiEnabler.resume();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mWifiLayer.onResume();
  mWifiEnabler.resume();
  if (mResumeState != null) {
    if (Keystore.getInstance().getState() == Keystore.UNLOCKED) {
      showAccessPointDialog(mResumeState,mResumeMode);
    }
    mResumeMode=-1;
    mResumeState=null;
  }
 else {
    if (mResumeMode == AccessPointDialog.MODE_CONFIGURE) {
      if (Keystore.getInstance().getState() == Keystore.UNLOCKED) {
        ((AccessPointDialog)mDialog).enableEnterpriseFields();
      }
    }
  }
}
Program: 181034
Project: 181034
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("String_Node_Str");
  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);
  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);
    }
  }
}
Program: 181035
Project: 181035
Buggy source:
/** 
 * Ask the current default engine to launch the matching CHECK_TTS_DATA activity to check the required TTS files are properly installed.
 */
private void checkVoiceData(){
  PackageManager pm=getPackageManager();
  Intent intent=new Intent();
  intent.setAction("String_Node_Str");
  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_INTEGRITY_CHECK);
    }
  }
}

Fixed version (ground truth):
/** 
 * Ask the current default engine to launch the matching CHECK_TTS_DATA activity to check the required TTS files are properly installed.
 */
private void checkVoiceData(){
  PackageManager pm=getPackageManager();
  Intent intent=new Intent();
  intent.setAction(TextToSpeech.Engine.ACTION_CHECK_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_INTEGRITY_CHECK);
    }
  }
}
Program: 181036
Project: 181036
Buggy source:
/** 
 * Called when the TTS engine is initialized.
 */
public void onInit(int status){
  if (status == TextToSpeech.TTS_SUCCESS) {
    Log.v(TAG,"String_Node_Str");
    mEnableDemo=true;
  }
 else {
    Log.v(TAG,"String_Node_Str");
    mEnableDemo=false;
  }
  updateWidgetState();
}

Fixed version (ground truth):
/** 
 * Called when the TTS engine is initialized.
 */
public void onInit(int status){
  if (status == TextToSpeech.SUCCESS) {
    Log.v(TAG,"String_Node_Str");
    mEnableDemo=true;
  }
 else {
    Log.v(TAG,"String_Node_Str");
    mEnableDemo=false;
  }
  updateWidgetState();
}
Program: 181037
Project: 181037
Buggy source:
/** 
 * Called when mPlayExample or mInstallData is clicked
 */
public boolean onPreferenceClick(Preference preference){
  if (preference == mPlayExample) {
    if (mTts != null) {
      mTts.speak(getResources().getString(R.string.tts_demo),TextToSpeech.TTS_QUEUE_FLUSH,null);
    }
    return true;
  }
  if (preference == mInstallData) {
    installVoiceData();
    finish();
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Called when mPlayExample or mInstallData is clicked
 */
public boolean onPreferenceClick(Preference preference){
  if (preference == mPlayExample) {
    if (mTts != null) {
      mTts.speak(getResources().getString(R.string.tts_demo),TextToSpeech.QUEUE_FLUSH,null);
    }
    return true;
  }
  if (preference == mInstallData) {
    installVoiceData();
    finish();
    return true;
  }
  return false;
}
Program: 181039
Project: 181039
Buggy source:
/** 
 * Called when voice data integrity check returns
 */
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == VOICE_DATA_INTEGRITY_CHECK) {
    if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
      Log.v(TAG,"String_Node_Str");
      if (mTts == null) {
        mTts=new TextToSpeech(this,this);
      }
    }
 else {
      Log.v(TAG,"String_Node_Str");
      mEnableDemo=false;
      updateWidgetState();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when voice data integrity check returns
 */
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == VOICE_DATA_INTEGRITY_CHECK) {
    if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
      Log.v(TAG,"String_Node_Str");
      if (mTts == null) {
        mTts=new TextToSpeech(this,this);
        mTts.setLanguage(Locale.getDefault());
      }
    }
 else {
      Log.v(TAG,"String_Node_Str");
      mEnableDemo=false;
      updateWidgetState();
    }
  }
}
Program: 181040
Project: 181040
Buggy source:
public boolean onPreferenceChange(Preference preference,Object objValue){
  if (KEY_TTS_USE_DEFAULT.equals(preference.getKey())) {
    int value=(Boolean)objValue ? 1 : 0;
    Settings.Secure.putInt(getContentResolver(),TTS_USE_DEFAULTS,value);
    Log.i(TAG,"String_Node_Str" + objValue.toString());
  }
 else   if (KEY_TTS_DEFAULT_RATE.equals(preference.getKey())) {
    int value=Integer.parseInt((String)objValue);
    try {
      Settings.Secure.putInt(getContentResolver(),TTS_DEFAULT_RATE,value);
      if (mTts != null) {
        mTts.setSpeechRate((float)(value / 100.0f));
      }
      Log.i(TAG,"String_Node_Str" + value);
    }
 catch (    NumberFormatException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
  }
 else   if (KEY_TTS_DEFAULT_LANG.equals(preference.getKey())) {
    ContentResolver resolver=getContentResolver();
    parseLocaleInfo((String)objValue);
    Settings.Secure.putString(resolver,TTS_DEFAULT_LANG,mDefaultLanguage);
    Settings.Secure.putString(resolver,TTS_DEFAULT_COUNTRY,mDefaultCountry);
    Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,mDefaultLocVariant);
    Log.v(TAG,"String_Node_Str" + mDefaultLanguage + "String_Node_Str"+ mDefaultCountry+ "String_Node_Str"+ mDefaultLocVariant);
  }
  return true;
}

Fixed version (ground truth):
public boolean onPreferenceChange(Preference preference,Object objValue){
  if (KEY_TTS_USE_DEFAULT.equals(preference.getKey())) {
    int value=(Boolean)objValue ? 1 : 0;
    Settings.Secure.putInt(getContentResolver(),TTS_USE_DEFAULTS,value);
    Log.i(TAG,"String_Node_Str" + objValue.toString());
  }
 else   if (KEY_TTS_DEFAULT_RATE.equals(preference.getKey())) {
    int value=Integer.parseInt((String)objValue);
    try {
      Settings.Secure.putInt(getContentResolver(),TTS_DEFAULT_RATE,value);
      if (mTts != null) {
        mTts.setSpeechRate((float)(value / 100.0f));
      }
      Log.i(TAG,"String_Node_Str" + value);
    }
 catch (    NumberFormatException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
  }
 else   if (KEY_TTS_DEFAULT_LANG.equals(preference.getKey())) {
    ContentResolver resolver=getContentResolver();
    parseLocaleInfo((String)objValue);
    Settings.Secure.putString(resolver,TTS_DEFAULT_LANG,mDefaultLanguage);
    Settings.Secure.putString(resolver,TTS_DEFAULT_COUNTRY,mDefaultCountry);
    Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,mDefaultLocVariant);
    Log.v(TAG,"String_Node_Str" + mDefaultLanguage + "String_Node_Str"+ mDefaultCountry+ "String_Node_Str"+ mDefaultLocVariant);
    if (mTts != null) {
      mTts.setLanguage(new Locale(mDefaultLanguage,mDefaultCountry));
    }
  }
  return true;
}
Program: 181041
Project: 181041
Buggy source:
/** 
 * Called when voice data integrity check returns
 */
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == VOICE_DATA_INTEGRITY_CHECK) {
    if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
      Log.v(TAG,"String_Node_Str");
      if (mTts == null) {
        mTts=new TextToSpeech(this,this);
      }
    }
 else {
      Log.v(TAG,"String_Node_Str");
      mEnableDemo=false;
      updateWidgetState();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when voice data integrity check returns
 */
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == VOICE_DATA_INTEGRITY_CHECK) {
    if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
      Log.v(TAG,"String_Node_Str");
      if (mTts == null) {
        mTts=new TextToSpeech(this,this);
        mTts.setLanguage(Locale.getDefault());
      }
    }
 else {
      Log.v(TAG,"String_Node_Str");
      mEnableDemo=false;
      updateWidgetState();
    }
  }
}
Program: 181042
Project: 181042
Buggy source:
public boolean onPreferenceChange(Preference preference,Object objValue){
  if (KEY_TTS_USE_DEFAULT.equals(preference.getKey())) {
    int value=(Boolean)objValue ? 1 : 0;
    Settings.Secure.putInt(getContentResolver(),TTS_USE_DEFAULTS,value);
    Log.i(TAG,"String_Node_Str" + objValue.toString());
  }
 else   if (KEY_TTS_DEFAULT_RATE.equals(preference.getKey())) {
    int value=Integer.parseInt((String)objValue);
    try {
      Settings.Secure.putInt(getContentResolver(),TTS_DEFAULT_RATE,value);
      if (mTts != null) {
        mTts.setSpeechRate((float)(value / 100.0f));
      }
      Log.i(TAG,"String_Node_Str" + value);
    }
 catch (    NumberFormatException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
  }
 else   if (KEY_TTS_DEFAULT_LANG.equals(preference.getKey())) {
    ContentResolver resolver=getContentResolver();
    parseLocaleInfo((String)objValue);
    Settings.Secure.putString(resolver,TTS_DEFAULT_LANG,mDefaultLanguage);
    Settings.Secure.putString(resolver,TTS_DEFAULT_COUNTRY,mDefaultCountry);
    Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,mDefaultLocVariant);
    Log.v(TAG,"String_Node_Str" + mDefaultLanguage + "String_Node_Str"+ mDefaultCountry+ "String_Node_Str"+ mDefaultLocVariant);
  }
  return true;
}

Fixed version (ground truth):
public boolean onPreferenceChange(Preference preference,Object objValue){
  if (KEY_TTS_USE_DEFAULT.equals(preference.getKey())) {
    int value=(Boolean)objValue ? 1 : 0;
    Settings.Secure.putInt(getContentResolver(),TTS_USE_DEFAULTS,value);
    Log.i(TAG,"String_Node_Str" + objValue.toString());
  }
 else   if (KEY_TTS_DEFAULT_RATE.equals(preference.getKey())) {
    int value=Integer.parseInt((String)objValue);
    try {
      Settings.Secure.putInt(getContentResolver(),TTS_DEFAULT_RATE,value);
      if (mTts != null) {
        mTts.setSpeechRate((float)(value / 100.0f));
      }
      Log.i(TAG,"String_Node_Str" + value);
    }
 catch (    NumberFormatException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
  }
 else   if (KEY_TTS_DEFAULT_LANG.equals(preference.getKey())) {
    ContentResolver resolver=getContentResolver();
    parseLocaleInfo((String)objValue);
    Settings.Secure.putString(resolver,TTS_DEFAULT_LANG,mDefaultLanguage);
    Settings.Secure.putString(resolver,TTS_DEFAULT_COUNTRY,mDefaultCountry);
    Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,mDefaultLocVariant);
    Log.v(TAG,"String_Node_Str" + mDefaultLanguage + "String_Node_Str"+ mDefaultCountry+ "String_Node_Str"+ mDefaultLocVariant);
    if (mTts != null) {
      mTts.setLanguage(new Locale(mDefaultLanguage,mDefaultCountry));
    }
  }
  return true;
}
Program: 181045
Project: 181045
Buggy source:
private void handleSave(){
  replaceStateWithWifiLayerInstance();
  String ssid=mSsidEdit.getText().toString();
  String password=mPasswordEdit.getText().toString();
  mState.setSsid(ssid);
  int securityType=getSecurityTypeFromSpinner();
  if (!TextUtils.isEmpty(password)) {
switch (securityType) {
case SECURITY_WPA_PERSONAL:
{
        mState.setSecurity(AccessPointState.WPA);
        mState.setPassword(password);
        break;
      }
case SECURITY_WPA2_PERSONAL:
{
      mState.setSecurity(AccessPointState.WPA2);
      mState.setPassword(password);
      break;
    }
case SECURITY_AUTO:
{
    mState.setPassword(password);
    break;
  }
case SECURITY_WEP:
{
  mState.setSecurity(AccessPointState.WEP);
  mState.setPassword(password,WEP_TYPE_VALUES[mWepTypeSpinner.getSelectedItemPosition()]);
  break;
}
}
}
 else {
mState.setSecurity(AccessPointState.OPEN);
}
if (securityType == SECURITY_NONE) {
mState.setSecurity(AccessPointState.OPEN);
}
if (!mWifiLayer.saveNetwork(mState)) {
return;
}
if (!mWifiLayer.connectToNetwork(mState)) {
return;
}
}

Fixed version (ground truth):
private void handleSave(){
  replaceStateWithWifiLayerInstance();
  String ssid=mSsidEdit.getText().toString();
  String password=mPasswordEdit.getText().toString();
  mState.setSsid(ssid);
  int securityType=getSecurityTypeFromSpinner();
  if (!TextUtils.isEmpty(password)) {
switch (securityType) {
case SECURITY_WPA_PERSONAL:
{
        mState.setSecurity(AccessPointState.WPA);
        mState.setPassword(password);
        break;
      }
case SECURITY_WPA2_PERSONAL:
{
      mState.setSecurity(AccessPointState.WPA2);
      mState.setPassword(password);
      break;
    }
case SECURITY_AUTO:
{
    mState.setPassword(password);
    break;
  }
case SECURITY_WEP:
{
  mState.setSecurity(AccessPointState.WEP);
  mState.setPassword(password,WEP_TYPE_VALUES[mWepTypeSpinner.getSelectedItemPosition()]);
  break;
}
}
}
 else {
switch (securityType) {
case SECURITY_WPA_EAP:
mState.setSecurity(AccessPointState.WPA_EAP);
break;
case SECURITY_IEEE8021X:
mState.setSecurity(AccessPointState.IEEE8021X);
break;
default :
mState.setSecurity(AccessPointState.OPEN);
break;
}
if (isEnterprise() && !mState.configured) {
updateEnterpriseFields(AccessPointState.WPA_EAP.equals(mState.security) ? SECURITY_WPA_EAP : SECURITY_IEEE8021X);
}
}
if (securityType == SECURITY_NONE) {
mState.setSecurity(AccessPointState.OPEN);
}
if (!mWifiLayer.saveNetwork(mState)) {
return;
}
if (!mWifiLayer.connectToNetwork(mState)) {
return;
}
}
Program: 181046
Project: 181046
Buggy source:
private void handleSave(){
  replaceStateWithWifiLayerInstance();
  String ssid=mSsidEdit.getText().toString();
  String password=mPasswordEdit.getText().toString();
  mState.setSsid(ssid);
  int securityType=getSecurityTypeFromSpinner();
  if (!TextUtils.isEmpty(password)) {
switch (securityType) {
case SECURITY_WPA_PERSONAL:
{
        mState.setSecurity(AccessPointState.WPA);
        mState.setPassword(password);
        break;
      }
case SECURITY_WPA2_PERSONAL:
{
      mState.setSecurity(AccessPointState.WPA2);
      mState.setPassword(password);
      break;
    }
case SECURITY_AUTO:
{
    mState.setPassword(password);
    break;
  }
case SECURITY_WEP:
{
  mState.setSecurity(AccessPointState.WEP);
  mState.setPassword(password,WEP_TYPE_VALUES[mWepTypeSpinner.getSelectedItemPosition()]);
  break;
}
}
}
 else {
mState.setSecurity(AccessPointState.OPEN);
}
if (securityType == SECURITY_NONE) {
mState.setSecurity(AccessPointState.OPEN);
}
if (!mWifiLayer.saveNetwork(mState)) {
return;
}
if (!mWifiLayer.connectToNetwork(mState)) {
return;
}
}

Fixed version (ground truth):
private void handleSave(){
  replaceStateWithWifiLayerInstance();
  String ssid=mSsidEdit.getText().toString();
  String password=mPasswordEdit.getText().toString();
  mState.setSsid(ssid);
  int securityType=getSecurityTypeFromSpinner();
  if (!TextUtils.isEmpty(password)) {
switch (securityType) {
case SECURITY_WPA_PERSONAL:
{
        mState.setSecurity(AccessPointState.WPA);
        mState.setPassword(password);
        break;
      }
case SECURITY_WPA2_PERSONAL:
{
      mState.setSecurity(AccessPointState.WPA2);
      mState.setPassword(password);
      break;
    }
case SECURITY_AUTO:
{
    mState.setPassword(password);
    break;
  }
case SECURITY_WEP:
{
  mState.setSecurity(AccessPointState.WEP);
  mState.setPassword(password,WEP_TYPE_VALUES[mWepTypeSpinner.getSelectedItemPosition()]);
  break;
}
}
}
 else {
switch (securityType) {
case SECURITY_WPA_EAP:
mState.setSecurity(AccessPointState.WPA_EAP);
break;
case SECURITY_IEEE8021X:
mState.setSecurity(AccessPointState.IEEE8021X);
break;
default :
mState.setSecurity(AccessPointState.OPEN);
break;
}
if (isEnterprise() && !mState.configured) {
updateEnterpriseFields(AccessPointState.WPA_EAP.equals(mState.security) ? SECURITY_WPA_EAP : SECURITY_IEEE8021X);
}
}
if (securityType == SECURITY_NONE) {
mState.setSecurity(AccessPointState.OPEN);
}
if (!mWifiLayer.saveNetwork(mState)) {
return;
}
if (!mWifiLayer.connectToNetwork(mState)) {
return;
}
}
Program: 181047
Project: 181047
Buggy source:
public void setChecked(boolean checked){
  mSelectedKey=getKey();
}

Fixed version (ground truth):
public void setChecked(){
  mSelectedKey=getKey();
}
Program: 181048
Project: 181048
Buggy source:
private void fillList(){
  String where="String_Node_Str" + android.os.SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC,"String_Node_Str") + "String_Node_Str";
  Cursor cursor=managedQuery(Telephony.Carriers.CONTENT_URI,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},where,Telephony.Carriers.DEFAULT_SORT_ORDER);
  PreferenceGroup apnList=(PreferenceGroup)findPreference("String_Node_Str");
  apnList.removeAll();
  ArrayList<Preference> mmsApnList=new ArrayList<Preference>();
  mSelectedKey=getSelectedApnKey();
  cursor.moveToFirst();
  while (!cursor.isAfterLast()) {
    String name=cursor.getString(NAME_INDEX);
    String apn=cursor.getString(APN_INDEX);
    String key=cursor.getString(ID_INDEX);
    String type=cursor.getString(TYPES_INDEX);
    ApnPreference pref=new ApnPreference(this);
    pref.setKey(key);
    pref.setTitle(name);
    pref.setSummary(apn);
    pref.setPersistent(false);
    pref.setOnPreferenceChangeListener(this);
    boolean selectable=((type == null) || !type.equals("String_Node_Str"));
    pref.setSelectable(selectable);
    if (selectable) {
      if ((mSelectedKey != null) && mSelectedKey.equals(key)) {
        pref.setChecked(true);
      }
      apnList.addPreference(pref);
    }
 else {
      mmsApnList.add(pref);
    }
    cursor.moveToNext();
  }
  cursor.close();
  for (  Preference preference : mmsApnList) {
    apnList.addPreference(preference);
  }
}

Fixed version (ground truth):
private void fillList(){
  String where="String_Node_Str" + android.os.SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC,"String_Node_Str") + "String_Node_Str";
  Cursor cursor=managedQuery(Telephony.Carriers.CONTENT_URI,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},where,Telephony.Carriers.DEFAULT_SORT_ORDER);
  PreferenceGroup apnList=(PreferenceGroup)findPreference("String_Node_Str");
  apnList.removeAll();
  ArrayList<Preference> mmsApnList=new ArrayList<Preference>();
  mSelectedKey=getSelectedApnKey();
  cursor.moveToFirst();
  while (!cursor.isAfterLast()) {
    String name=cursor.getString(NAME_INDEX);
    String apn=cursor.getString(APN_INDEX);
    String key=cursor.getString(ID_INDEX);
    String type=cursor.getString(TYPES_INDEX);
    ApnPreference pref=new ApnPreference(this);
    pref.setKey(key);
    pref.setTitle(name);
    pref.setSummary(apn);
    pref.setPersistent(false);
    pref.setOnPreferenceChangeListener(this);
    boolean selectable=((type == null) || !type.equals("String_Node_Str"));
    pref.setSelectable(selectable);
    if (selectable) {
      if ((mSelectedKey != null) && mSelectedKey.equals(key)) {
        pref.setChecked();
      }
      apnList.addPreference(pref);
    }
 else {
      mmsApnList.add(pref);
    }
    cursor.moveToNext();
  }
  cursor.close();
  for (  Preference preference : mmsApnList) {
    apnList.addPreference(preference);
  }
}
Program: 181049
Project: 181049
Buggy source:
/** 
 * Format a number of tenths-units as a decimal string without using a conversion to float.  E.g. 347 -> "34.7"
 */
private final String tenthsToFixedString(int x){
  int tens=x / 10;
  return new String("String_Node_Str" + tens + "String_Node_Str"+ (x - 10 * tens));
}

Fixed version (ground truth):
/** 
 * Format a number of tenths-units as a decimal string without using a conversion to float.  E.g. 347 -> "34.7"
 */
private final String tenthsToFixedString(int x){
  int tens=x / 10;
  return Integer.toString(tens) + "String_Node_Str" + (x - 10 * tens);
}
Program: 181050
Project: 181050
Buggy source:
private void displayQxdmEnableResult(){
  String status=mQxdmLogEnabled ? "String_Node_Str" : "String_Node_Str";
  DialogInterface mProgressPanel=new AlertDialog.Builder(this).setMessage(status).show();
  mHandler.postDelayed(new Runnable(){
    public void run(){
      finish();
    }
  }
,2000);
}

Fixed version (ground truth):
private void displayQxdmEnableResult(){
  String status=mQxdmLogEnabled ? "String_Node_Str" : "String_Node_Str";
  new AlertDialog.Builder(this).setMessage(status).show();
  mHandler.postDelayed(new Runnable(){
    public void run(){
      finish();
    }
  }
,2000);
}