Program: 187786
Project: 187786
Buggy source:
private void getNoteFromContentProvider(){
  if (mCursor != null && mCursor.requery() && mCursor.moveToFirst()) {
    if (mState == STATE_EDIT) {
      setTitle(getText(R.string.title_edit));
    }
 else     if (mState == STATE_INSERT) {
      setTitle(getText(R.string.title_create));
    }
    long id=mCursor.getLong(COLUMN_INDEX_ID);
    String note=mCursor.getString(COLUMN_INDEX_NOTE);
    long encrypted=mCursor.getLong(COLUMN_INDEX_ENCRYPTED);
    mTheme=mCursor.getString(COLUMN_INDEX_THEME);
    if (encrypted == 0) {
      if (!note.equals(mText.getText().toString())) {
        mText.setTextKeepState(note);
        mText.setSelection(mSelectionStart,mSelectionStop);
      }
    }
 else {
      if (mDecryptedText != null) {
        mText.setTextKeepState(mDecryptedText);
        mText.setSelection(mSelectionStart,mSelectionStop);
        setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON,android.R.drawable.ic_lock_idle_lock);
      }
 else {
        Intent i=new Intent();
        i.setAction(CryptoIntents.ACTION_DECRYPT);
        i.putExtra(CryptoIntents.EXTRA_TEXT,note);
        i.putExtra(PrivateNotePadIntents.EXTRA_ID,id);
        try {
          startActivityForResult(i,REQUEST_CODE_DECRYPT);
        }
 catch (        ActivityNotFoundException e) {
          Toast.makeText(this,R.string.decryption_failed,Toast.LENGTH_SHORT).show();
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
    if (mOriginalContent == null) {
      mOriginalContent=note;
    }
  }
 else {
    setTitle(getText(R.string.error_title));
    mText.setText(getText(R.string.error_message));
  }
}

Fixed version (ground truth):
private void getNoteFromContentProvider(){
  if (mCursor != null && mCursor.requery() && mCursor.moveToFirst()) {
    if (mState == STATE_EDIT) {
      setTitle(getText(R.string.title_edit));
    }
 else     if (mState == STATE_INSERT) {
      setTitle(getText(R.string.title_create));
    }
    long id=mCursor.getLong(COLUMN_INDEX_ID);
    String note=mCursor.getString(COLUMN_INDEX_NOTE);
    mEncrypted=mCursor.getLong(COLUMN_INDEX_ENCRYPTED);
    mTheme=mCursor.getString(COLUMN_INDEX_THEME);
    if (mEncrypted == 0) {
      if (!note.equals(mText.getText().toString())) {
        mText.setTextKeepState(note);
        mText.setSelection(mSelectionStart,mSelectionStop);
      }
    }
 else {
      if (mDecryptedText != null) {
        mText.setTextKeepState(mDecryptedText);
        mText.setSelection(mSelectionStart,mSelectionStop);
        setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON,android.R.drawable.ic_lock_idle_lock);
      }
 else {
        Intent i=new Intent();
        i.setAction(CryptoIntents.ACTION_DECRYPT);
        i.putExtra(CryptoIntents.EXTRA_TEXT,note);
        i.putExtra(PrivateNotePadIntents.EXTRA_ID,id);
        try {
          startActivityForResult(i,REQUEST_CODE_DECRYPT);
        }
 catch (        ActivityNotFoundException e) {
          Toast.makeText(this,R.string.decryption_failed,Toast.LENGTH_SHORT).show();
          Log.e(TAG,"String_Node_Str");
        }
      }
    }
    if (mOriginalContent == null) {
      mOriginalContent=note;
    }
  }
 else {
    setTitle(getText(R.string.error_title));
    mText.setText(getText(R.string.error_message));
  }
}