Program: 157362
Project: 157362
Buggy source:
private void handleSeparator(int primaryCode){
  mExpectingSelectionUpdateBy=SystemClock.uptimeMillis() + MAX_TIME_TO_EXPECT_SELECTION_UPDATE;
  boolean isEndOfSentence=(primaryCode == KeyCodes.ENTER || mSentenceSeparators.get(primaryCode));
  if (mCandidateView != null && mCandidateView.dismissAddToDictionaryHint()) {
    postUpdateSuggestions();
  }
  InputConnection ic=getCurrentInputConnection();
  if (ic != null) {
    ic.beginBatchEdit();
  }
  final boolean separatorInsideWord=(mWord.cursorPosition() < mWord.length());
  if (mPredicting && !separatorInsideWord) {
    if (primaryCode != '\'') {
      pickDefaultSuggestion(mAutoCorrectOn && primaryCode != KeyCodes.ENTER);
      if (primaryCode == KeyCodes.SPACE) {
        mJustAddedAutoSpace=true;
      }
    }
 else {
      commitTyped(ic);
      if (isEndOfSentence)       abortCorrection(true,false);
    }
  }
 else   if (separatorInsideWord) {
    abortCorrection(true,false);
  }
  if (mJustAddedAutoSpace && primaryCode == KeyCodes.ENTER) {
    removeTrailingSpace();
    mJustAddedAutoSpace=false;
  }
  final EditorInfo ei=getCurrentInputEditorInfo();
  if (primaryCode == KeyCodes.ENTER && mShiftKeyState.isActive() && ic != null && ei != null && (ei.imeOptions & EditorInfo.IME_MASK_ACTION) != EditorInfo.IME_ACTION_NONE) {
    ic.commitText("String_Node_Str",1);
  }
 else {
    sendKeyChar((char)primaryCode);
    TextEntryState.typedCharacter((char)primaryCode,true);
    if (ic != null) {
      if (primaryCode == KeyCodes.SPACE) {
        if (mAskPrefs.isDoubleSpaceChangesToPeriod()) {
          if ((SystemClock.uptimeMillis() - mLastSpaceTimeStamp) < ((long)mAskPrefs.getMultiTapTimeout())) {
            ic.deleteSurroundingText(2,0);
            ic.commitText("String_Node_Str",1);
            mJustAddedAutoSpace=true;
            isEndOfSentence=true;
          }
        }
      }
 else       if (mJustAddedAutoSpace && mAskPrefs.shouldSwapPunctuationAndSpace() && primaryCode != KeyCodes.ENTER) {
        swapPunctuationAndSpace(ic);
      }
    }
  }
  if (ic != null) {
    ic.endBatchEdit();
  }
  if (isEndOfSentence) {
    mSuggest.resetNextWordSentence();
    clearSuggestions();
  }
 else   if (!TextUtils.isEmpty(mCommittedWord)) {
    setSuggestions(mSuggest.getNextSuggestions(mCommittedWord,mWord.isAllUpperCase()),false,false,false);
    mWord.setFirstCharCapitalized(false);
  }
}

Fixed version (ground truth):
private void handleSeparator(int primaryCode){
  mExpectingSelectionUpdateBy=SystemClock.uptimeMillis() + MAX_TIME_TO_EXPECT_SELECTION_UPDATE;
  boolean isEndOfSentence=(primaryCode == KeyCodes.ENTER || mSentenceSeparators.get(primaryCode));
  if (mCandidateView != null && mCandidateView.dismissAddToDictionaryHint()) {
    postUpdateSuggestions();
  }
  InputConnection ic=getCurrentInputConnection();
  if (ic != null) {
    ic.beginBatchEdit();
  }
  final boolean separatorInsideWord=(mWord.cursorPosition() < mWord.length());
  if (mPredicting && !separatorInsideWord) {
    if (primaryCode != '\'') {
      pickDefaultSuggestion(mAutoCorrectOn && primaryCode != KeyCodes.ENTER);
      if (primaryCode == KeyCodes.SPACE) {
        mJustAddedAutoSpace=true;
      }
    }
 else {
      commitTyped(ic);
      if (isEndOfSentence)       abortCorrection(true,false);
    }
  }
 else   if (separatorInsideWord) {
    abortCorrection(true,false);
  }
  if (mJustAddedAutoSpace && primaryCode == KeyCodes.ENTER) {
    removeTrailingSpace();
    mJustAddedAutoSpace=false;
  }
  final EditorInfo ei=getCurrentInputEditorInfo();
  if (primaryCode == KeyCodes.ENTER && mShiftKeyState.isActive() && ic != null && ei != null && (ei.imeOptions & EditorInfo.IME_MASK_ACTION) != EditorInfo.IME_ACTION_NONE) {
    ic.commitText("String_Node_Str",1);
  }
 else {
    sendKeyChar((char)primaryCode);
    TextEntryState.typedCharacter((char)primaryCode,true);
    if (ic != null) {
      if (primaryCode == KeyCodes.SPACE) {
        if (mAskPrefs.isDoubleSpaceChangesToPeriod()) {
          if ((SystemClock.uptimeMillis() - mLastSpaceTimeStamp) < ((long)mAskPrefs.getMultiTapTimeout())) {
            ic.deleteSurroundingText(2,0);
            ic.commitText("String_Node_Str",1);
            mJustAddedAutoSpace=true;
            isEndOfSentence=true;
          }
        }
      }
 else       if (mJustAddedAutoSpace && mAskPrefs.shouldSwapPunctuationAndSpace() && primaryCode != KeyCodes.ENTER && isSentenceSeparator(primaryCode)) {
        swapPunctuationAndSpace(ic,(char)primaryCode);
      }
    }
  }
  if (ic != null) {
    ic.endBatchEdit();
  }
  if (isEndOfSentence) {
    mSuggest.resetNextWordSentence();
    clearSuggestions();
  }
 else   if (!TextUtils.isEmpty(mCommittedWord)) {
    setSuggestions(mSuggest.getNextSuggestions(mCommittedWord,mWord.isAllUpperCase()),false,false,false);
    mWord.setFirstCharCapitalized(false);
  }
}