nus-yam/ex-repair huggingface dataset:
Program: 187811
Project: 187811
Buggy source:
/** 
 * Insert textToInsert at current position. Optionally, if textBefore or textAfter are non-null, replace the text before or after the current selection.
 * @author isaac
 * @author Peli
 */
private void insertAtPoint(String textBefore,String textToInsert,String textAfter){
  String originalText=mText.getText().toString();
  int startPos=mText.getSelectionStart();
  int endPos=mText.getSelectionEnd();
  int newStartPos=startPos;
  int newEndPos=endPos;
  ContentValues values=new ContentValues();
  String newNote="String_Node_Str";
  StringBuffer sb=new StringBuffer();
  if (textBefore != null) {
    sb.append(textBefore);
    newStartPos=textBefore.length();
  }
 else {
    sb.append(originalText.substring(0,startPos));
  }
  if (textToInsert != null) {
    sb.append(textToInsert);
    newEndPos=newStartPos + textToInsert.length();
  }
 else {
    String text=originalText.substring(startPos,endPos);
    sb.append(text);
    newEndPos=newStartPos + text.length();
  }
  if (textAfter != null) {
    sb.append(textAfter);
  }
 else {
    sb.append(originalText.substring(endPos));
  }
  newNote=sb.toString();
  if (!mNoteOnly) {
    values.put(Notes.MODIFIED_DATE,System.currentTimeMillis());
    String title=ExtractTitle.extractTitle(newNote);
    values.put(Notes.TITLE,title);
  }
  values.put(Notes.NOTE,newNote);
  getContentResolver().update(mUri,values,null,null);
  mText.setTextKeepState(newNote);
  mText.setSelection(newStartPos,newEndPos);
}

Fixed version (ground truth):
/** 
 * Insert textToInsert at current position. Optionally, if textBefore or textAfter are non-null, replace the text before or after the current selection.
 * @author isaac
 * @author Peli
 */
private void insertAtPoint(String textBefore,String textToInsert,String textAfter){
  String originalText=mText.getText().toString();
  int startPos=mText.getSelectionStart();
  int endPos=mText.getSelectionEnd();
  int newStartPos=startPos;
  int newEndPos=endPos;
  ContentValues values=new ContentValues();
  String newNote="String_Node_Str";
  StringBuffer sb=new StringBuffer();
  if (textBefore != null) {
    sb.append(textBefore);
    newStartPos=textBefore.length();
  }
 else {
    sb.append(originalText.substring(0,startPos));
  }
  if (textToInsert != null) {
    sb.append(textToInsert);
    newEndPos=newStartPos + textToInsert.length();
  }
 else {
    String text=originalText.substring(startPos,endPos);
    sb.append(text);
    newEndPos=newStartPos + text.length();
  }
  if (textAfter != null) {
    sb.append(textAfter);
  }
 else {
    sb.append(originalText.substring(endPos));
  }
  newNote=sb.toString();
  if (mState == STATE_EDIT_NOTE_FROM_SDCARD) {
    mFileContent=newNote;
    mSelectionStart=newStartPos;
    mSelectionStop=newEndPos;
  }
 else {
    if (!mNoteOnly) {
      values.put(Notes.MODIFIED_DATE,System.currentTimeMillis());
      String title=ExtractTitle.extractTitle(newNote);
      values.put(Notes.TITLE,title);
    }
    values.put(Notes.NOTE,newNote);
    getContentResolver().update(mUri,values,null,null);
  }
  mText.setTextKeepState(newNote);
  mText.setSelection(newStartPos,newEndPos);
}
Program: 187812
Project: 187812
Buggy source:
@Override protected void onResume(){
  super.onResume();
  Log.d(TAG,"String_Node_Str");
  if (mState == STATE_EDIT || mState == STATE_INSERT) {
    getNoteFromContentProvider();
  }
 else   if (mState == STATE_EDIT_NOTE_FROM_SDCARD) {
    getNoteFromFile();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (mState == STATE_EDIT || mState == STATE_INSERT) {
    getNoteFromContentProvider();
  }
 else   if (mState == STATE_EDIT_NOTE_FROM_SDCARD) {
    getNoteFromFile();
  }
}
Program: 187813
Project: 187813
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  mSelectionStart=mText.getSelectionStart();
  mSelectionStop=mText.getSelectionEnd();
  mFileContent=mText.getText().toString();
  outState.putString(BUNDLE_ORIGINAL_CONTENT,mOriginalContent);
  outState.putInt(BUNDLE_STATE,mState);
  outState.putString(BUNDLE_URI,mUri.toString());
  outState.putInt(BUNDLE_SELECTION_START,mSelectionStart);
  outState.putInt(BUNDLE_SELECTION_STOP,mSelectionStop);
  outState.putString(BUNDLE_FILE_CONTENT,mFileContent);
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  if (debug)   Log.i(TAG,"String_Node_Str");
  if (debug)   Log.i(TAG,"String_Node_Str" + mFileContent);
  mSelectionStart=mText.getSelectionStart();
  mSelectionStop=mText.getSelectionEnd();
  mFileContent=mText.getText().toString();
  outState.putString(BUNDLE_ORIGINAL_CONTENT,mOriginalContent);
  outState.putInt(BUNDLE_STATE,mState);
  outState.putString(BUNDLE_URI,mUri.toString());
  outState.putInt(BUNDLE_SELECTION_START,mSelectionStart);
  outState.putInt(BUNDLE_SELECTION_STOP,mSelectionStop);
  outState.putString(BUNDLE_FILE_CONTENT,mFileContent);
}
Program: 187814
Project: 187814
Buggy source:
/** 
 * Convert Uri into String.
 * @param uri
 * @return file
 */
public static String getFilename(Uri uri){
  if (uri != null) {
    String filepath=uri.toString();
    if (filepath.startsWith("String_Node_Str")) {
      filepath=filepath.substring(7);
    }
    return filepath;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Convert Uri into String.
 * @param uri
 * @return file
 */
public static String getFilename(Uri uri){
  File file=getFile(uri);
  if (file != null) {
    return file.getAbsolutePath();
  }
  return null;
}
Program: 187815
Project: 187815
Buggy source:
/** 
 * Convert String into Uri.
 * @param file
 * @return uri
 */
public static Uri getUri(String filename){
  return Uri.parse("String_Node_Str" + filename);
}

Fixed version (ground truth):
/** 
 * Convert String into Uri.
 * @param file
 * @return uri
 */
public static Uri getUri(String filename){
  return getUri(new File(filename));
}
Program: 187816
Project: 187816
Buggy source:
public Cursor runQuery(CharSequence constraint){
  if (mItemsCursor != null) {
    Log.d(TAG,"String_Node_Str");
    stopManagingCursor(mItemsCursor);
  }
  mItemsCursor=managedQuery(Items.CONTENT_URI,new String[]{Items._ID,Items.NAME},"String_Node_Str" + (constraint == null ? "String_Node_Str" : constraint.toString().toUpperCase()) + "String_Node_Str",null,"String_Node_Str");
  return mItemsCursor;
}

Fixed version (ground truth):
public Cursor runQuery(CharSequence constraint){
  if (mItemsCursor != null) {
    Log.d(TAG,"String_Node_Str");
    stopManagingCursor(mItemsCursor);
  }
  mItemsCursor=managedQuery(Items.CONTENT_URI,new String[]{Items._ID,Items.NAME},"String_Node_Str",new String[]{"String_Node_Str" + (constraint == null ? "String_Node_Str" : constraint.toString().toUpperCase()) + "String_Node_Str"},"String_Node_Str");
  return mItemsCursor;
}
Program: 187818
Project: 187818
Buggy source:
public void onNothingSelected(AdapterView arg0){
  Log.d(TAG,"String_Node_Str");
  fillItems();
}

Fixed version (ground truth):
public void onNothingSelected(AdapterView arg0){
  Log.d(TAG,"String_Node_Str" + mIsActive);
  Log.i(TAG,"String_Node_Str" + mIsActive);
  if (mIsActive) {
    fillItems();
  }
}
Program: 187819
Project: 187819
Buggy source:
public Cursor runQuery(CharSequence constraint){
  mItemsCursor=managedQuery(Items.CONTENT_URI,new String[]{Items._ID,Items.NAME},"String_Node_Str" + (constraint == null ? "String_Node_Str" : constraint.toString().toUpperCase()) + "String_Node_Str",null,"String_Node_Str");
  return mItemsCursor;
}

Fixed version (ground truth):
public Cursor runQuery(CharSequence constraint){
  if (mItemsCursor != null) {
    Log.d(TAG,"String_Node_Str");
    stopManagingCursor(mItemsCursor);
    mItemsCursor.close();
    mItemsCursor=null;
  }
  mItemsCursor=managedQuery(Items.CONTENT_URI,new String[]{Items._ID,Items.NAME},"String_Node_Str" + (constraint == null ? "String_Node_Str" : constraint.toString().toUpperCase()) + "String_Node_Str",null,"String_Node_Str");
  return mItemsCursor;
}
Program: 187820
Project: 187820
Buggy source:
@Override protected void onResume(){
  super.onResume();
  Log.i(TAG,"String_Node_Str");
  if (mState == STATE_MAIN || mState == STATE_VIEW_LIST) {
  }
 else   if ((mState == STATE_PICK_ITEM) || (mState == STATE_GET_CONTENT_ITEM)) {
    setTitle(getText(R.string.pick_item));
    setTitleColor(0xFFAAAAFF);
  }
  mListItemsView.setListTheme(loadListTheme());
  mListItemsView.onResume();
  mEditText.setKeyListener(PreferenceActivity.getCapitalizationKeyListenerFromPrefs(getApplicationContext()));
  if (!mUpdating) {
    mUpdating=true;
  }
  initFromPreferences();
  registerSensor();
}

Fixed version (ground truth):
@Override protected void onResume(){
  Log.i(TAG,"String_Node_Str");
  super.onResume();
  Log.i(TAG,"String_Node_Str");
  mIsActive=true;
  if (mState == STATE_MAIN || mState == STATE_VIEW_LIST) {
  }
 else   if ((mState == STATE_PICK_ITEM) || (mState == STATE_GET_CONTENT_ITEM)) {
    setTitle(getText(R.string.pick_item));
    setTitleColor(0xFFAAAAFF);
  }
  mListItemsView.setListTheme(loadListTheme());
  mListItemsView.onResume();
  mEditText.setKeyListener(PreferenceActivity.getCapitalizationKeyListenerFromPrefs(getApplicationContext()));
  if (!mUpdating) {
    mUpdating=true;
  }
  initFromPreferences();
  registerSensor();
}
Program: 187821
Project: 187821
Buggy source:
@Override protected void onPause(){
  super.onPause();
  Log.i(TAG,"String_Node_Str");
  unregisterSensor();
  SharedPreferences sp=getSharedPreferences("String_Node_Str",MODE_PRIVATE);
  SharedPreferences.Editor editor=sp.edit();
  editor.putInt(PreferenceActivity.PREFS_LASTUSED,new Long(getSelectedListId()).intValue());
  editor.commit();
  mListItemsView.onPause();
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  Log.i(TAG,"String_Node_Str");
  Log.i(TAG,"String_Node_Str" + mIsActive);
  mIsActive=false;
  Log.i(TAG,"String_Node_Str" + mIsActive);
  unregisterSensor();
  SharedPreferences sp=getSharedPreferences("String_Node_Str",MODE_PRIVATE);
  SharedPreferences.Editor editor=sp.edit();
  editor.putInt(PreferenceActivity.PREFS_LASTUSED,new Long(getSelectedListId()).intValue());
  editor.commit();
  mListItemsView.onPause();
}
Program: 187823
Project: 187823
Buggy source:
/** 
 */
private void populateFields(){
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (RowId != null) {
    CategoryEntry catEntry=Passwords.getCategoryEntry(RowId);
    nameText.setText(catEntry.plainName);
  }
}

Fixed version (ground truth):
/** 
 */
private void populateFields(){
  if (debug)   Log.d(TAG,"String_Node_Str");
  if ((RowId != null) && (RowId > 0)) {
    CategoryEntry catEntry=Passwords.getCategoryEntry(RowId);
    if (catEntry == null) {
      return;
    }
    nameText.setText(catEntry.plainName);
  }
}
Program: 187824
Project: 187824
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (!CategoryList.isSignedIn()) {
    Intent frontdoor=new Intent(this,FrontDoor.class);
    startActivity(frontdoor);
    finish();
  }
  populateFields();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (!CategoryList.isSignedIn()) {
    Intent frontdoor=new Intent(this,FrontDoor.class);
    startActivity(frontdoor);
    finish();
    return;
  }
  populateFields();
}
Program: 187825
Project: 187825
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (debug)   Log.d(TAG,"String_Node_Str");
  restartTimerIntent=new Intent(CryptoIntents.ACTION_RESTART_TIMER);
  if (!isSignedIn()) {
    Intent frontdoor=new Intent(this,FrontDoor.class);
    startActivity(frontdoor);
    finish();
  }
  try {
    Passwords.InitCrypto(CryptoHelper.EncryptionMedium,salt,masterKey);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Toast.makeText(CategoryList.this,"String_Node_Str" + getString(R.string.crypto_error),Toast.LENGTH_SHORT).show();
  }
  setContentView(R.layout.cat_list);
  String title=getResources().getString(R.string.app_name) + "String_Node_Str" + getResources().getString(R.string.categories);
  setTitle(title);
  if (Passwords.getPrePopulate() == true) {
    prePopulate();
    Passwords.clearPrePopulate();
  }
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(CryptoIntents.ACTION_CRYPTO_LOGGED_OUT);
  registerReceiver(mIntentReceiver,filter);
  fillData();
  final ListView list=getListView();
  list.setFocusable(true);
  list.setOnCreateContextMenuListener(this);
  registerForContextMenu(list);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (debug)   Log.d(TAG,"String_Node_Str");
  restartTimerIntent=new Intent(CryptoIntents.ACTION_RESTART_TIMER);
  if (isSignedIn() == false) {
    Intent frontdoor=new Intent(this,FrontDoor.class);
    startActivity(frontdoor);
    finish();
    return;
  }
  try {
    Passwords.InitCrypto(CryptoHelper.EncryptionMedium,salt,masterKey);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Toast.makeText(CategoryList.this,"String_Node_Str" + getString(R.string.crypto_error),Toast.LENGTH_SHORT).show();
  }
  setContentView(R.layout.cat_list);
  String title=getResources().getString(R.string.app_name) + "String_Node_Str" + getResources().getString(R.string.categories);
  setTitle(title);
  if (Passwords.getPrePopulate() == true) {
    prePopulate();
    Passwords.clearPrePopulate();
  }
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(CryptoIntents.ACTION_CRYPTO_LOGGED_OUT);
  registerReceiver(mIntentReceiver,filter);
  fillData();
  final ListView list=getListView();
  list.setFocusable(true);
  list.setOnCreateContextMenuListener(this);
  registerForContextMenu(list);
}
Program: 187826
Project: 187826
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (!isSignedIn()) {
    Intent frontdoor=new Intent(this,FrontDoor.class);
    startActivity(frontdoor);
    finish();
  }
  showFirstTimeWarningDialog();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (isSignedIn() == false) {
    Intent frontdoor=new Intent(this,FrontDoor.class);
    startActivity(frontdoor);
    finish();
    return;
  }
  showFirstTimeWarningDialog();
}
Program: 187827
Project: 187827
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    finish();
  }
  setContentView(R.layout.chg_pass);
  String title=getResources().getString(R.string.app_name) + "String_Node_Str" + getResources().getString(R.string.change_password);
  setTitle(title);
  Button changePasswordButton=(Button)findViewById(R.id.change_password_button);
  changePasswordButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View arg0){
      performChangePass();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    finish();
    return;
  }
  setContentView(R.layout.chg_pass);
  String title=getResources().getString(R.string.app_name) + "String_Node_Str" + getResources().getString(R.string.change_password);
  setTitle(title);
  Button changePasswordButton=(Button)findViewById(R.id.change_password_button);
  changePasswordButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View arg0){
      performChangePass();
    }
  }
);
}
Program: 187828
Project: 187828
Buggy source:
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.help);
  String title=getResources().getString(R.string.app_name) + "String_Node_Str" + getResources().getString(R.string.help);
  setTitle(title);
  try {
    InputStream is=getAssets().open("String_Node_Str");
    int size=is.available();
    byte[] buffer=new byte[size];
    is.read(buffer);
    is.close();
    String text=new String(buffer);
    final String mimeType="String_Node_Str";
    final String encoding="String_Node_Str";
    WebView wv=(WebView)findViewById(R.id.help);
    wv.loadData(text,mimeType,encoding);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (CategoryList.isSignedIn() == false) {
    finish();
    return;
  }
  setContentView(R.layout.help);
  String title=getResources().getString(R.string.app_name) + "String_Node_Str" + getResources().getString(R.string.help);
  setTitle(title);
  try {
    InputStream is=getAssets().open("String_Node_Str");
    int size=is.available();
    byte[] buffer=new byte[size];
    is.read(buffer);
    is.close();
    String text=new String(buffer);
    final String mimeType="String_Node_Str";
    final String encoding="String_Node_Str";
    WebView wv=(WebView)findViewById(R.id.help);
    wv.loadData(text,mimeType,encoding);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 187829
Project: 187829
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    finish();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    finish();
    return;
  }
}
Program: 187831
Project: 187831
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    saveState();
    finish();
  }
  populateFields();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    saveState();
    finish();
    return;
  }
  populateFields();
}
Program: 187832
Project: 187832
Buggy source:
public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.pass_gen);
  String title=getResources().getString(R.string.app_name) + "String_Node_Str";
  setTitle(title);
  pass_view=(EditText)findViewById(R.id.pass_view);
  pass_len=(EditText)findViewById(R.id.pass_length);
  pass_upper=(CheckBox)findViewById(R.id.pass_upper);
  pass_lower=(CheckBox)findViewById(R.id.pass_lower);
  pass_num=(CheckBox)findViewById(R.id.pass_num);
  pass_symbol=(CheckBox)findViewById(R.id.pass_symbol);
  pass_view.setOnClickListener(update_click);
  pass_len.setOnKeyListener(update_key);
  pass_len.setOnFocusChangeListener(update_focus);
  pass_upper.setOnCheckedChangeListener(update_checked);
  pass_lower.setOnCheckedChangeListener(update_checked);
  pass_num.setOnCheckedChangeListener(update_checked);
  pass_symbol.setOnCheckedChangeListener(update_checked);
  copy_clip=(Button)findViewById(R.id.copy_clip);
  copy_entry=(Button)findViewById(R.id.copy_entry);
  cancel=(Button)findViewById(R.id.cancel);
  copy_clip.setOnClickListener(copy_clip_listener);
  copy_entry.setOnClickListener(copy_entry_listener);
  cancel.setOnClickListener(cancel_listener);
}

Fixed version (ground truth):
public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (CategoryList.isSignedIn() == false) {
    finish();
    return;
  }
  setContentView(R.layout.pass_gen);
  String title=getResources().getString(R.string.app_name) + "String_Node_Str";
  setTitle(title);
  pass_view=(EditText)findViewById(R.id.pass_view);
  pass_len=(EditText)findViewById(R.id.pass_length);
  pass_upper=(CheckBox)findViewById(R.id.pass_upper);
  pass_lower=(CheckBox)findViewById(R.id.pass_lower);
  pass_num=(CheckBox)findViewById(R.id.pass_num);
  pass_symbol=(CheckBox)findViewById(R.id.pass_symbol);
  pass_view.setOnClickListener(update_click);
  pass_len.setOnKeyListener(update_key);
  pass_len.setOnFocusChangeListener(update_focus);
  pass_upper.setOnCheckedChangeListener(update_checked);
  pass_lower.setOnCheckedChangeListener(update_checked);
  pass_num.setOnCheckedChangeListener(update_checked);
  pass_symbol.setOnCheckedChangeListener(update_checked);
  copy_clip=(Button)findViewById(R.id.copy_clip);
  copy_entry=(Button)findViewById(R.id.copy_entry);
  cancel=(Button)findViewById(R.id.cancel);
  copy_clip.setOnClickListener(copy_clip_listener);
  copy_entry.setOnClickListener(copy_entry_listener);
  cancel.setOnClickListener(cancel_listener);
}
Program: 187833
Project: 187833
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (!CategoryList.isSignedIn()) {
    finish();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (CategoryList.isSignedIn() == false) {
    finish();
    return;
  }
}
Program: 187834
Project: 187834
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (!CategoryList.isSignedIn()) {
    finish();
  }
  restartTimerIntent=new Intent(CryptoIntents.ACTION_RESTART_TIMER);
  setContentView(R.layout.pass_list);
  CategoryId=icicle != null ? icicle.getLong(CategoryList.KEY_ID) : null;
  if (CategoryId == null) {
    Bundle extras=getIntent().getExtras();
    CategoryId=extras != null ? extras.getLong(CategoryList.KEY_ID) : null;
  }
  if (CategoryId < 1) {
    finish();
  }
  String categoryName=Passwords.getCategoryEntry(CategoryId).plainName;
  String title=getResources().getString(R.string.app_name) + "String_Node_Str" + getResources().getString(R.string.passwords)+ "String_Node_Str"+ categoryName;
  setTitle(title);
  fillData();
  final ListView list=getListView();
  list.setFocusable(true);
  list.setOnCreateContextMenuListener(this);
  registerForContextMenu(list);
  sendBroadcast(restartTimerIntent);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    finish();
    return;
  }
  restartTimerIntent=new Intent(CryptoIntents.ACTION_RESTART_TIMER);
  setContentView(R.layout.pass_list);
  CategoryId=icicle != null ? icicle.getLong(CategoryList.KEY_ID) : null;
  if (CategoryId == null) {
    Bundle extras=getIntent().getExtras();
    CategoryId=extras != null ? extras.getLong(CategoryList.KEY_ID) : null;
  }
  if (CategoryId < 1) {
    finish();
    return;
  }
  String categoryName=Passwords.getCategoryEntry(CategoryId).plainName;
  String title=getResources().getString(R.string.app_name) + "String_Node_Str" + getResources().getString(R.string.passwords)+ "String_Node_Str"+ categoryName;
  setTitle(title);
  fillData();
  final ListView list=getListView();
  list.setFocusable(true);
  list.setOnCreateContextMenuListener(this);
  registerForContextMenu(list);
  sendBroadcast(restartTimerIntent);
}
Program: 187835
Project: 187835
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    finish();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    finish();
    return;
  }
}
Program: 187837
Project: 187837
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    finish();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (CategoryList.isSignedIn() == false) {
    finish();
    return;
  }
}
Program: 187838
Project: 187838
Buggy source:
public static CategoryEntry getCategoryEntry(Long id){
  CategoryEntry catEntry=categoryEntries.get(id);
  if (catEntry.nameNeedsDecrypt) {
    if (debug)     Log.d(TAG,"String_Node_Str");
    try {
      catEntry.plainName=ch.decrypt(catEntry.name);
    }
 catch (    CryptoHelperException e) {
      Log.e(TAG,e.toString());
    }
    catEntry.nameNeedsDecrypt=false;
    categoryEntries.put(id,catEntry);
  }
  return catEntry;
}

Fixed version (ground truth):
public static CategoryEntry getCategoryEntry(Long id){
  CategoryEntry catEntry=categoryEntries.get(id);
  if (catEntry == null) {
    return null;
  }
  if (catEntry.nameNeedsDecrypt) {
    if (debug)     Log.d(TAG,"String_Node_Str");
    try {
      catEntry.plainName=ch.decrypt(catEntry.name);
    }
 catch (    CryptoHelperException e) {
      Log.e(TAG,e.toString());
    }
    catEntry.nameNeedsDecrypt=false;
    categoryEntries.put(id,catEntry);
  }
  return catEntry;
}
Program: 187839
Project: 187839
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (CategoryList.isSignedIn() == false) {
    finish();
    return;
  }
  addPreferencesFromResource(R.xml.preferences);
}
Program: 187841
Project: 187841
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if ((!firstTime) && (!CategoryList.isSignedIn())) {
    Intent frontdoor=new Intent(this,FrontDoor.class);
    startActivity(frontdoor);
    finish();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if ((!firstTime) && (CategoryList.isSignedIn() == false)) {
    Intent frontdoor=new Intent(this,FrontDoor.class);
    startActivity(frontdoor);
    finish();
    return;
  }
}
Program: 187842
Project: 187842
Buggy source:
public void onNothingSelected(AdapterView arg0){
  fillItems();
}

Fixed version (ground truth):
public void onNothingSelected(AdapterView arg0){
  Log.d(TAG,"String_Node_Str");
  fillItems();
}
Program: 187843
Project: 187843
Buggy source:
/** 
 * Rename item from dialog.
 * @param price
 * @param tags
 * @return true if new list was renamed. False if new list was not renamed,because user has not given any name.
 */
private boolean updateItem(String newName,String tags,Long price){
  if (newName.equals("String_Node_Str")) {
    Toast.makeText(this,getString(R.string.please_enter_name),Toast.LENGTH_SHORT).show();
    return false;
  }
  String oldItemName=mCursorItems.getString(mStringItemsITEMNAME);
  String newItemName=newName;
  long itemId=mCursorItems.getLong(mStringItemsITEMID);
  Cursor cursor=getContentResolver().query(Shopping.Items.CONTENT_URI,Shopping.Items.PROJECTION,Shopping.Items._ID + "String_Node_Str",new String[]{"String_Node_Str" + itemId},Shopping.Items.DEFAULT_SORT_ORDER);
  if (cursor != null && cursor.moveToNext()) {
    ContentValues values=new ContentValues();
    values.put(Items.NAME,newItemName);
    values.put(Items.TAGS,tags);
    if (price != null) {
      values.put(Items.PRICE,price);
    }
    getContentResolver().update(Uri.withAppendedPath(Items.CONTENT_URI,cursor.getString(0)),values,null,null);
  }
 else {
    Log.e(TAG,"String_Node_Str");
  }
  mCursorItems.requery();
  return true;
}

Fixed version (ground truth):
/** 
 * Rename item from dialog.
 * @param price
 * @param tags
 * @return true if new list was renamed. False if new list was not renamed,because user has not given any name.
 */
private boolean updateItem(String newName,String tags,Long price){
  Log.d(TAG,"String_Node_Str");
  if (newName.equals("String_Node_Str")) {
    Toast.makeText(this,getString(R.string.please_enter_name),Toast.LENGTH_SHORT).show();
    return false;
  }
  mCursorItems.moveToPosition(mEditItemPosition);
  String oldItemName=mCursorItems.getString(mStringItemsITEMNAME);
  String newItemName=newName;
  dumpCursorItems();
  long itemId=mCursorItems.getLong(mStringItemsITEMID);
  Log.d(TAG,"String_Node_Str" + mCursorItems.getPosition());
  Log.d(TAG,"String_Node_Str" + mCursorItems.getString(mStringItemsITEMNAME));
  Log.d(TAG,"String_Node_Str" + itemId);
  Cursor cursor=getContentResolver().query(Shopping.Items.CONTENT_URI,Shopping.Items.PROJECTION,Shopping.Items._ID + "String_Node_Str",new String[]{"String_Node_Str" + itemId},Shopping.Items.DEFAULT_SORT_ORDER);
  if (cursor != null && cursor.moveToNext()) {
    ContentValues values=new ContentValues();
    values.put(Items.NAME,newItemName);
    values.put(Items.TAGS,tags);
    if (price != null) {
      values.put(Items.PRICE,price);
    }
    getContentResolver().update(Uri.withAppendedPath(Items.CONTENT_URI,cursor.getString(0)),values,null,null);
  }
 else {
    Log.e(TAG,"String_Node_Str");
  }
  mCursorItems.requery();
  return true;
}
Program: 187844
Project: 187844
Buggy source:
private void onModeChanged(){
  fillItems();
  if (mMode == MODE_IN_SHOP) {
    setTitle(getString(R.string.shopping_title,getCurrentListName()));
    registerSensor();
  }
 else {
    setTitle(getString(R.string.pick_items_titel,getCurrentListName()));
    unregisterSensor();
  }
}

Fixed version (ground truth):
private void onModeChanged(){
  Log.d(TAG,"String_Node_Str");
  fillItems();
  if (mMode == MODE_IN_SHOP) {
    setTitle(getString(R.string.shopping_title,getCurrentListName()));
    registerSensor();
  }
 else {
    setTitle(getString(R.string.pick_items_titel,getCurrentListName()));
    unregisterSensor();
  }
}
Program: 187845
Project: 187845
Buggy source:
private void fillItems(){
  long listId=getSelectedListId();
  if (listId < 0) {
    return;
  }
  mCursorItems=mListItems.fillItems(listId);
  startManagingCursor(mCursorItems);
  mCursorItems.moveToFirst();
}

Fixed version (ground truth):
private void fillItems(){
  Log.d(TAG,"String_Node_Str");
  long listId=getSelectedListId();
  if (listId < 0) {
    return;
  }
  mCursorItems=mListItems.fillItems(listId);
  startManagingCursor(mCursorItems);
  dumpCursorItems();
  mCursorItems.moveToFirst();
  if (mEditItemPosition != -1) {
    Log.d(TAG,"String_Node_Str" + mEditItemPosition);
    mCursorItems.moveToPosition(mEditItemPosition);
  }
}
Program: 187846
Project: 187846
Buggy source:
/** 
 * Edit item 
 */
void editItem(int position){
  mCursorItems.moveToPosition(position);
  showListDialog(MENU_EDIT_ITEM);
}

Fixed version (ground truth):
/** 
 * Edit item 
 */
void editItem(int position){
  Log.d(TAG,"String_Node_Str" + position);
  mCursorItems.moveToPosition(position);
  mEditItemPosition=position;
  showListDialog(MENU_EDIT_ITEM);
}
Program: 187849
Project: 187849
Buggy source:
public void onItemSelected(AdapterView parent,View v,int position,long id){
  fillItems();
  mListItems.setListTheme(loadListTheme());
  bindGTalkIfNeeded();
}

Fixed version (ground truth):
public void onItemSelected(AdapterView parent,View v,int position,long id){
  Log.d(TAG,"String_Node_Str");
  fillItems();
  mListItems.setListTheme(loadListTheme());
  bindGTalkIfNeeded();
}
Program: 187850
Project: 187850
Buggy source:
@Override protected Dialog onCreateDialog(int id){
  if (debug)   Log.d(TAG,"String_Node_Str" + mTextEntryMenu);
switch (id) {
case DIALOG_ABOUT:
    return new AboutDialog(this);
case DIALOG_TEXT_ENTRY:
  LayoutInflater factory=LayoutInflater.from(this);
final View textEntryView=factory.inflate(R.layout.input_box,null);
final Dialog dlg=new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_menu_edit).setTitle(R.string.ask_new_list).setView(textEntryView).setPositiveButton(R.string.ok,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int whichButton){
  dialog.dismiss();
  doTextEntryDialogAction(mTextEntryMenu,(Dialog)dialog);
}
}
).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int whichButton){
  dialog.cancel();
}
}
).create();
EditText et=(EditText)textEntryView.findViewById(R.id.edittext);
et.setKeyListener(PreferenceActivity.getCapitalizationKeyListenerFromPrefs(getApplicationContext()));
et.setOnKeyListener(new OnKeyListener(){
public boolean onKey(final View v,final int keyCode,final KeyEvent key){
if (mTextEntryMenu != MENU_EDIT_ITEM && key.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
doTextEntryDialogAction(mTextEntryMenu,dlg);
return true;
}
return false;
}
}
);
prepareTextDialog(dlg,textEntryView);
return dlg;
}
return null;
}

Fixed version (ground truth):
@Override protected Dialog onCreateDialog(int id){
  if (debug)   Log.d(TAG,"String_Node_Str" + mTextEntryMenu);
switch (id) {
case DIALOG_ABOUT:
    return new AboutDialog(this);
case DIALOG_TEXT_ENTRY:
  LayoutInflater factory=LayoutInflater.from(this);
final View textEntryView=factory.inflate(R.layout.input_box,null);
final Dialog dlg=new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_menu_edit).setTitle(R.string.ask_new_list).setView(textEntryView).setPositiveButton(R.string.ok,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int whichButton){
  dialog.dismiss();
  doTextEntryDialogAction(mTextEntryMenu,(Dialog)dialog);
}
}
).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int whichButton){
  dialog.cancel();
}
}
).create();
EditText et=(EditText)textEntryView.findViewById(R.id.edittext);
et.setKeyListener(PreferenceActivity.getCapitalizationKeyListenerFromPrefs(getApplicationContext()));
et.setOnKeyListener(new OnKeyListener(){
public boolean onKey(final View v,final int keyCode,final KeyEvent key){
if (mTextEntryMenu != MENU_EDIT_ITEM && key.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
doTextEntryDialogAction(mTextEntryMenu,dlg);
return true;
}
return false;
}
}
);
prepareTextDialog(dlg,textEntryView);
dlg.setOnDismissListener(new Dialog.OnDismissListener(){
@Override public void onDismiss(DialogInterface dialog){
Log.i(TAG,"String_Node_Str");
mEditItemPosition=-1;
}
}
);
return dlg;
}
return null;
}
Program: 187851
Project: 187851
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  Log.i(TAG,"String_Node_Str");
  String s=mEditText.getText().toString();
  outState.putString(ORIGINAL_ITEM,s);
  outState.putInt(BUNDLE_TEXT_ENTRY_MENU,mTextEntryMenu);
  mUpdating=false;
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  Log.i(TAG,"String_Node_Str");
  String s=mEditText.getText().toString();
  outState.putString(ORIGINAL_ITEM,s);
  outState.putInt(BUNDLE_TEXT_ENTRY_MENU,mTextEntryMenu);
  int pos=mEditItemPosition;
  Log.d(TAG,"String_Node_Str" + pos);
  outState.putInt(BUNDLE_CURSOR_ITEMS_POSITION,pos);
  mUpdating=false;
}
Program: 187852
Project: 187852
Buggy source:
public void onResume(){
  registerContentObserver();
}

Fixed version (ground truth):
public void onResume(){
}
Program: 187856
Project: 187856
Buggy source:
void saveTags(){
  if (mTextView == null) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  String tags=mTextView.getText().toString();
  if (mEncrypted == 0) {
    ContentValues values=new ContentValues(1);
    values.put(Notes.MODIFIED_DATE,System.currentTimeMillis());
    values.put(Notes.TAGS,tags);
    mContext.getContentResolver().update(mUri,values,null,null);
    mContext.getContentResolver().notifyChange(mUri,null);
  }
 else {
    Intent i=new Intent(mContext,EncryptActivity.class);
    i.putExtra(NotePadIntents.EXTRA_ACTION,CryptoIntents.ACTION_ENCRYPT);
    i.putExtra(CryptoIntents.EXTRA_TEXT_ARRAY,EncryptActivity.getCryptoStringArray(null,null,tags));
    i.putExtra(NotePadIntents.EXTRA_URI,mUri.toString());
    mContext.startActivity(i);
  }
}

Fixed version (ground truth):
void saveTags(){
  if (mTextView == null) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  String tags=mTextView.getText().toString();
  if (mEncrypted == 0) {
    ContentValues values=new ContentValues(2);
    values.put(Notes.MODIFIED_DATE,System.currentTimeMillis());
    values.put(Notes.TAGS,tags);
    mContext.getContentResolver().update(mUri,values,null,null);
    mContext.getContentResolver().notifyChange(mUri,null);
  }
 else {
    Intent i=new Intent(mContext,EncryptActivity.class);
    i.putExtra(NotePadIntents.EXTRA_ACTION,CryptoIntents.ACTION_ENCRYPT);
    i.putExtra(CryptoIntents.EXTRA_TEXT_ARRAY,EncryptActivity.getCryptoStringArray(null,null,tags));
    i.putExtra(NotePadIntents.EXTRA_URI,mUri.toString());
    mContext.startActivity(i);
  }
}
Program: 187857
Project: 187857
Buggy source:
@Override public void onRestoreInstanceState(Bundle savedInstanceState){
  super.onRestoreInstanceState(savedInstanceState);
  String tags=savedInstanceState.getString(BUNDLE_TAGS);
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Bundle savedInstanceState){
  super.onRestoreInstanceState(savedInstanceState);
  mUri=Uri.parse(savedInstanceState.getString(BUNDLE_URI));
  mEncrypted=savedInstanceState.getLong(BUNDLE_ENCRYPTED);
}
Program: 187858
Project: 187858
Buggy source:
@Override public Bundle onSaveInstanceState(){
  Bundle state=super.onSaveInstanceState();
  state.putString(BUNDLE_TAGS,"String_Node_Str");
  return state;
}

Fixed version (ground truth):
@Override public Bundle onSaveInstanceState(){
  Bundle state=super.onSaveInstanceState();
  state.putString(BUNDLE_URI,mUri.toString());
  state.putLong(BUNDLE_ENCRYPTED,mEncrypted);
  return state;
}
Program: 187859
Project: 187859
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  mServiceIntent=null;
  mPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  initService();
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  mServiceIntent=null;
  mPreferences=PreferenceManager.getDefaultSharedPreferences(this);
}
Program: 187861
Project: 187861
Buggy source:
@Override protected void onResume(){
  super.onPause();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (dbHelper == null) {
    dbHelper=new DBHelper(this);
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onPause();
  if (debug)   Log.d(TAG,"String_Node_Str");
  if (dbHelper == null) {
    dbHelper=new DBHelper(this);
  }
  initService();
}
Program: 187862
Project: 187862
Buggy source:
@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  menu.setHeaderTitle(cursor.getString(NotesListCursor.COLUMN_INDEX_TITLE));
  menu.add(0,MENU_ITEM_SEND_BY_EMAIL,0,R.string.menu_send_by_email);
  menu.add(0,MENU_ITEM_EDIT_TAGS,0,R.string.menu_edit_tags);
  menu.add(0,MENU_ITEM_SAVE,0,R.string.menu_save_to_sdcard);
  long encrypted=cursor.getLong(NotesListCursor.COLUMN_INDEX_ENCRYPTED);
  if (encrypted <= 0) {
    menu.add(0,MENU_ITEM_ENCRYPT,0,R.string.menu_encrypt);
  }
 else {
    menu.add(0,MENU_ITEM_UNENCRYPT,0,R.string.menu_undo_encryption);
  }
  menu.add(0,MENU_ITEM_DELETE,0,R.string.menu_delete);
}

Fixed version (ground truth):
@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  long encrypted=cursor.getLong(NotesListCursor.COLUMN_INDEX_ENCRYPTED);
  menu.setHeaderTitle(cursor.getString(NotesListCursor.COLUMN_INDEX_TITLE));
  menu.add(0,MENU_ITEM_EDIT_TAGS,0,R.string.menu_edit_tags);
  if (encrypted == 0) {
    menu.add(0,MENU_ITEM_SEND_BY_EMAIL,0,R.string.menu_send_by_email);
    menu.add(0,MENU_ITEM_SAVE,0,R.string.menu_save_to_sdcard);
    menu.add(0,MENU_ITEM_ENCRYPT,0,R.string.menu_encrypt);
  }
 else {
    menu.add(0,MENU_ITEM_UNENCRYPT,0,R.string.menu_undo_encryption);
  }
  menu.add(0,MENU_ITEM_DELETE,0,R.string.menu_delete);
}
Program: 187863
Project: 187863
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent i){
  super.onActivityResult(requestCode,resultCode,i);
  if (dbHelper == null) {
    dbHelper=new DBHelper(this);
  }
  if (((requestCode == REQUEST_VIEW_PASSWORD) && (PassView.entryEdited)) || ((requestCode == REQUEST_EDIT_PASSWORD) && (PassEdit.entryEdited)) || (resultCode == RESULT_OK)) {
    fillData();
  }
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent i){
  super.onActivityResult(requestCode,resultCode,i);
  if (dbHelper == null) {
    dbHelper=new DBHelper(this);
  }
  if (((requestCode == REQUEST_VIEW_PASSWORD) && (PassView.entryEdited)) || ((requestCode == REQUEST_EDIT_PASSWORD) && (PassEdit.entryEdited)) || ((requestCode == REQUEST_ADD_PASSWORD) && (PassEdit.entryEdited))|| (resultCode == RESULT_OK)) {
    fillData();
  }
}
Program: 187864
Project: 187864
Buggy source:
/** 
 * @param data
 */
private void setServiceParametersFromExtrasAndDispatchAction(Intent data){
  salt=data.getStringExtra("String_Node_Str");
  masterKey=data.getStringExtra("String_Node_Str");
  String timeout=mPreferences.getString(Preferences.PREFERENCE_LOCK_TIMEOUT,Preferences.PREFERENCE_LOCK_TIMEOUT_DEFAULT_VALUE);
  int timeoutMinutes=5;
  try {
    timeoutMinutes=Integer.valueOf(timeout);
  }
 catch (  NumberFormatException e) {
    Log.d(TAG,"String_Node_Str");
  }
  try {
    service.setTimeoutMinutes(timeoutMinutes);
    service.setSalt(salt);
    service.setPassword(masterKey);
  }
 catch (  RemoteException e1) {
    e1.printStackTrace();
  }
  boolean externalAccess=mPreferences.getBoolean(Preferences.PREFERENCE_ALLOW_EXTERNAL_ACCESS,false);
  boolean isLocal=isIntentLocal();
  if (isLocal || externalAccess) {
    actionDispatch();
  }
 else {
    if (debug)     Log.d(TAG,"String_Node_Str");
    showDialogAllowExternalAccess();
  }
}

Fixed version (ground truth):
/** 
 * @param data
 */
private void setServiceParametersFromExtrasAndDispatchAction(Intent data){
  salt=data.getStringExtra("String_Node_Str");
  masterKey=data.getStringExtra("String_Node_Str");
  String timeout=mPreferences.getString(Preferences.PREFERENCE_LOCK_TIMEOUT,Preferences.PREFERENCE_LOCK_TIMEOUT_DEFAULT_VALUE);
  int timeoutMinutes=5;
  try {
    timeoutMinutes=Integer.valueOf(timeout);
  }
 catch (  NumberFormatException e) {
    Log.d(TAG,"String_Node_Str");
  }
  try {
    service.setTimeoutMinutes(timeoutMinutes);
    service.setSalt(salt);
    service.setPassword(masterKey);
  }
 catch (  RemoteException e1) {
    e1.printStackTrace();
  }
  boolean externalAccess=mPreferences.getBoolean(Preferences.PREFERENCE_ALLOW_EXTERNAL_ACCESS,false);
  boolean isLocal=isIntentLocal();
  if (isLocal || externalAccess) {
    actionDispatch();
  }
 else {
  }
}
Program: 187865
Project: 187865
Buggy source:
@Override protected void onPause(){
  super.onPause();
  if (discardEntry == false) {
    savePassword();
  }
  dbHelper.close();
  dbHelper=null;
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  if (isFinishing() && discardEntry == false) {
    savePassword();
  }
  dbHelper.close();
  dbHelper=null;
}
Program: 187866
Project: 187866
Buggy source:
/** 
 * Encrypt the current note.
 * @param text
 */
private void encryptNote(){
  String text=mText.getText().toString();
  String title=ExtractTitle.extractTitle(text);
  Intent i=new Intent(this,EncryptActivity.class);
  i.putExtra(NotePadIntents.EXTRA_ACTION,CryptoIntents.ACTION_ENCRYPT);
  i.putExtra(CryptoIntents.EXTRA_TEXT_ARRAY,EncryptActivity.getCryptoStringArray(text,title,null));
  i.putExtra(NotePadIntents.EXTRA_URI,mUri.toString());
  startActivity(i);
}

Fixed version (ground truth):
/** 
 * Encrypt the current note.
 * @param text
 */
private void encryptNote(boolean encryptTags){
  String text=mText.getText().toString();
  String title=ExtractTitle.extractTitle(text);
  String tags=getTags();
  Log.i(TAG,"String_Node_Str" + tags);
  if (!encryptTags) {
    tags=null;
  }
  Intent i=new Intent(this,EncryptActivity.class);
  i.putExtra(NotePadIntents.EXTRA_ACTION,CryptoIntents.ACTION_ENCRYPT);
  i.putExtra(CryptoIntents.EXTRA_TEXT_ARRAY,EncryptActivity.getCryptoStringArray(text,title,tags));
  i.putExtra(NotePadIntents.EXTRA_URI,mUri.toString());
  startActivity(i);
}
Program: 187867
Project: 187867
Buggy source:
@Override protected void onPause(){
  super.onPause();
  Log.d(TAG,"String_Node_Str");
  if (mCursor != null) {
    mCursor.moveToFirst();
    long encrypted=mCursor.getLong(COLUMN_INDEX_ENCRYPTED);
    if (encrypted == 0) {
      String text=mText.getText().toString();
      int length=text.length();
      if (isFinishing() && (length == 0) && !mNoteOnly) {
        setResult(RESULT_CANCELED);
        deleteNote();
      }
 else {
        ContentValues values=new ContentValues();
        if (!mNoteOnly) {
          values.put(Notes.MODIFIED_DATE,System.currentTimeMillis());
          String title=ExtractTitle.extractTitle(text);
          values.put(Notes.TITLE,title);
        }
        values.put(Notes.NOTE,text);
        getContentResolver().update(mUri,values,null,null);
      }
    }
 else {
      if (mDecryptedText != null) {
        encryptNote();
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  Log.d(TAG,"String_Node_Str");
  if (mCursor != null) {
    mCursor.moveToFirst();
    long encrypted=mCursor.getLong(COLUMN_INDEX_ENCRYPTED);
    if (encrypted == 0) {
      String text=mText.getText().toString();
      int length=text.length();
      if (isFinishing() && (length == 0) && !mNoteOnly) {
        setResult(RESULT_CANCELED);
        deleteNote();
      }
 else {
        ContentValues values=new ContentValues();
        if (!mNoteOnly) {
          values.put(Notes.MODIFIED_DATE,System.currentTimeMillis());
          String title=ExtractTitle.extractTitle(text);
          values.put(Notes.TITLE,title);
        }
        values.put(Notes.NOTE,text);
        getContentResolver().update(mUri,values,null,null);
      }
    }
 else {
      if (mDecryptedText != null) {
        encryptNote(false);
      }
    }
  }
}
Program: 187868
Project: 187868
Buggy source:
/** 
 * Unencrypt the current note.
 * @param text
 */
private void unencryptNote(){
  String text=mText.getText().toString();
  String title=ExtractTitle.extractTitle(text);
  ContentValues values=new ContentValues();
  values.put(Notes.MODIFIED_DATE,System.currentTimeMillis());
  values.put(Notes.TITLE,title);
  values.put(Notes.NOTE,text);
  values.put(Notes.ENCRYPTED,0);
  getContentResolver().update(mUri,values,null,null);
  mCursor.requery();
  setFeatureDrawable(Window.FEATURE_RIGHT_ICON,null);
}

Fixed version (ground truth):
/** 
 * Unencrypt the current note.
 * @param text
 */
private void unencryptNote(){
  String text=mText.getText().toString();
  String title=ExtractTitle.extractTitle(text);
  String tags=getTags();
  Log.i(TAG,"String_Node_Str" + tags);
  ContentValues values=new ContentValues();
  values.put(Notes.MODIFIED_DATE,System.currentTimeMillis());
  values.put(Notes.TITLE,title);
  values.put(Notes.NOTE,text);
  values.put(Notes.ENCRYPTED,0);
  getContentResolver().update(mUri,values,null,null);
  mCursor.requery();
  setFeatureDrawable(Window.FEATURE_RIGHT_ICON,null);
  Intent i=new Intent(this,EncryptActivity.class);
  i.putExtra(NotePadIntents.EXTRA_ACTION,CryptoIntents.ACTION_DECRYPT);
  i.putExtra(CryptoIntents.EXTRA_TEXT_ARRAY,EncryptActivity.getCryptoStringArray(null,null,tags));
  i.putExtra(NotePadIntents.EXTRA_URI,mUri.toString());
  startActivity(i);
}