Program: 187775
Project: 187775
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (debug)   Log.d(TAG,"String_Node_Str");
  mDecryptedText=null;
  mSelectionStart=0;
  mSelectionStop=0;
  if (savedInstanceState != null) {
    mOriginalContent=savedInstanceState.getString(BUNDLE_ORIGINAL_CONTENT);
    mState=savedInstanceState.getInt(BUNDLE_STATE);
    mUri=Uri.parse(savedInstanceState.getString(BUNDLE_URI));
    mSelectionStart=savedInstanceState.getInt(BUNDLE_SELECTION_START);
    mSelectionStop=savedInstanceState.getInt(BUNDLE_SELECTION_STOP);
    mFileContent=savedInstanceState.getString(BUNDLE_FILE_CONTENT);
    if (mApplyText == null && mApplyTextBefore == null && mApplyTextAfter == null) {
      mApplyText=savedInstanceState.getString(BUNDLE_APPLY_TEXT);
      mApplyTextBefore=savedInstanceState.getString(BUNDLE_APPLY_TEXT_BEFORE);
      mApplyTextAfter=savedInstanceState.getString(BUNDLE_APPLY_TEXT_AFTER);
    }
  }
 else {
    final Intent intent=getIntent();
    final String action=intent.getAction();
    if (Intent.ACTION_EDIT.equals(action) || Intent.ACTION_VIEW.equals(action)) {
      mState=STATE_EDIT;
      mUri=intent.getData();
      if (mUri.getScheme().equals("String_Node_Str")) {
        mState=STATE_EDIT_NOTE_FROM_SDCARD;
        mFileContent=readFile(FileUriUtils.getFile(mUri));
      }
    }
 else     if (Intent.ACTION_INSERT.equals(action)) {
      ContentValues values=new ContentValues(1);
      String theme=getMostRecentlyUsedTheme();
      values.put(Notes.THEME,theme);
      String tags=intent.getStringExtra(NotepadInternalIntents.EXTRA_TAGS);
      values.put(Notes.TAGS,tags);
      mState=STATE_INSERT;
      mUri=getContentResolver().insert(intent.getData(),values);
      if (mUri == null) {
        Log.e(TAG,"String_Node_Str" + getIntent().getData());
        finish();
        return;
      }
      setResult(RESULT_OK,intent);
    }
 else {
      Log.e(TAG,"String_Node_Str");
      finish();
      return;
    }
  }
  requestWindowFeature(Window.FEATURE_RIGHT_ICON);
  setContentView(R.layout.note_editor);
  mText=(EditText)findViewById(R.id.note);
  if (mState == STATE_EDIT_NOTE_FROM_SDCARD) {
    mText.addTextChangedListener(mTextWatcherSdCard);
  }
  if (mState != STATE_EDIT_NOTE_FROM_SDCARD) {
    mCursor=managedQuery(mUri,PROJECTION,null,null,null);
  }
 else {
    mCursor=null;
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (debug)   Log.d(TAG,"String_Node_Str");
  mDecryptedText=sDecryptedText;
  if (sDecryptedText != null) {
    EncryptActivity.cancelEncrypt();
    if (EncryptActivity.getPendingEncryptActivities() == 0) {
      if (debug)       Log.d(TAG,"String_Node_Str");
      sDecryptedText=null;
    }
  }
  mSelectionStart=0;
  mSelectionStop=0;
  if (savedInstanceState != null) {
    mOriginalContent=savedInstanceState.getString(BUNDLE_ORIGINAL_CONTENT);
    mState=savedInstanceState.getInt(BUNDLE_STATE);
    mUri=Uri.parse(savedInstanceState.getString(BUNDLE_URI));
    mSelectionStart=savedInstanceState.getInt(BUNDLE_SELECTION_START);
    mSelectionStop=savedInstanceState.getInt(BUNDLE_SELECTION_STOP);
    mFileContent=savedInstanceState.getString(BUNDLE_FILE_CONTENT);
    if (mApplyText == null && mApplyTextBefore == null && mApplyTextAfter == null) {
      mApplyText=savedInstanceState.getString(BUNDLE_APPLY_TEXT);
      mApplyTextBefore=savedInstanceState.getString(BUNDLE_APPLY_TEXT_BEFORE);
      mApplyTextAfter=savedInstanceState.getString(BUNDLE_APPLY_TEXT_AFTER);
    }
  }
 else {
    final Intent intent=getIntent();
    final String action=intent.getAction();
    if (Intent.ACTION_EDIT.equals(action) || Intent.ACTION_VIEW.equals(action)) {
      mState=STATE_EDIT;
      mUri=intent.getData();
      if (mUri.getScheme().equals("String_Node_Str")) {
        mState=STATE_EDIT_NOTE_FROM_SDCARD;
        mFileContent=readFile(FileUriUtils.getFile(mUri));
      }
    }
 else     if (Intent.ACTION_INSERT.equals(action)) {
      ContentValues values=new ContentValues(1);
      String theme=getMostRecentlyUsedTheme();
      values.put(Notes.THEME,theme);
      String tags=intent.getStringExtra(NotepadInternalIntents.EXTRA_TAGS);
      values.put(Notes.TAGS,tags);
      mState=STATE_INSERT;
      mUri=getContentResolver().insert(intent.getData(),values);
      if (mUri == null) {
        Log.e(TAG,"String_Node_Str" + getIntent().getData());
        finish();
        return;
      }
      setResult(RESULT_OK,intent);
    }
 else {
      Log.e(TAG,"String_Node_Str");
      finish();
      return;
    }
  }
  requestWindowFeature(Window.FEATURE_RIGHT_ICON);
  setContentView(R.layout.note_editor);
  mText=(EditText)findViewById(R.id.note);
  if (mState == STATE_EDIT_NOTE_FROM_SDCARD) {
    mText.addTextChangedListener(mTextWatcherSdCard);
  }
  if (mState != STATE_EDIT_NOTE_FROM_SDCARD) {
    mCursor=managedQuery(mUri,PROJECTION,null,null,null);
  }
 else {
    mCursor=null;
  }
}