Program: 157375
Project: 157375
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();
  }
  boolean pickedDefault=false;
  InputConnection ic=getCurrentInputConnection();
  if (ic != null) {
    ic.beginBatchEdit();
  }
  final boolean separatorInsideWord=(mWord.cursorPosition() < mWord.length());
  if (mPredicting && !separatorInsideWord) {
    if (mAutoCorrectOn && primaryCode != '\'' && primaryCode != KeyCodes.ENTER) {
      pickedDefault=pickDefaultSuggestion();
      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);
  }
  if (mJustAddedAutoSpace && primaryCode == '.') {
    swapPeriodAndSpace();
  }
  TextEntryState.typedCharacter((char)primaryCode,true);
  if (TextEntryState.getState() == TextEntryState.State.PUNCTUATION_AFTER_ACCEPTED && primaryCode != KeyCodes.ENTER) {
    swapPunctuationAndSpace();
  }
 else   if (primaryCode == ' ') {
    if (doubleSpace()) {
      isEndOfSentence=true;
    }
  }
  if (pickedDefault && mWord.getPreferredWord() != null) {
    TextEntryState.acceptedDefault(mWord.getTypedWord(),mWord.getPreferredWord());
  }
  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);
  }
  if (mJustAddedAutoSpace && primaryCode == '.') {
    swapPeriodAndSpace();
  }
  TextEntryState.typedCharacter((char)primaryCode,true);
  if (TextEntryState.getState() == TextEntryState.State.PUNCTUATION_AFTER_ACCEPTED && primaryCode != KeyCodes.ENTER) {
    swapPunctuationAndSpace();
  }
 else   if (primaryCode == ' ') {
    if (doubleSpace()) {
      isEndOfSentence=true;
    }
  }
  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);
  }
}