Program: 157597
Project: 157597
Buggy source:
public void onKey(int primaryCode,int[] keyCodes){
  if (DEBUG)   Log.d("String_Node_Str","String_Node_Str" + primaryCode);
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE:
    handleBackspace();
  break;
case Keyboard.KEYCODE_SHIFT:
handleShift();
break;
case Keyboard.KEYCODE_CANCEL:
if (mOptionsDialog == null || !mOptionsDialog.isShowing()) {
handleClose();
}
break;
case AnyKeyboardView.KEYCODE_OPTIONS:
showOptionsMenu();
break;
case AnyKeyboard.KEYCODE_SMILEY:
if (mSmileyOnShortPress) {
onText(mConfig.getSmileyText());
}
 else {
if (mInputView != null) mInputView.simulateLongPress(AnyKeyboard.KEYCODE_SMILEY);
}
break;
case AnyKeyboardView.KEYCODE_SMILEY_LONGPRESS:
if (mSmileyOnShortPress) {
if (mInputView != null) mInputView.simulateLongPress(AnyKeyboard.KEYCODE_SMILEY);
}
 else {
onText(mConfig.getSmileyText());
}
break;
case Keyboard.KEYCODE_MODE_CHANGE:
nextKeyboard(getCurrentInputEditorInfo(),NextKeyboardType.Symbols);
break;
case AnyKeyboard.KEYCODE_LANG_CHANGE:
nextKeyboard(getCurrentInputEditorInfo(),NextKeyboardType.Alphabet);
break;
case KEYCODE_SPACE:
if (DEBUG) Log.d("String_Node_Str","String_Node_Str" + mSwitchKeyboardOnSpace);
if (mSwitchKeyboardOnSpace && !mKeyboardSwitcher.isAlphabetMode()) nextKeyboard(getCurrentInputEditorInfo(),NextKeyboardType.Alphabet);
default :
primaryCode=translatePrimaryCodeFromCurrentKeyboard(primaryCode);
if (isWordSeparator(primaryCode)) {
handleSeparator(primaryCode);
}
 else {
handleCharacter(primaryCode,keyCodes);
mSpaceSent=false;
}
mJustRevertedSeparator=null;
}
}

Fixed version (ground truth):
public void onKey(int primaryCode,int[] keyCodes){
  if (DEBUG)   Log.d("String_Node_Str","String_Node_Str" + primaryCode);
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE:
    handleBackspace();
  break;
case Keyboard.KEYCODE_SHIFT:
handleShift();
break;
case Keyboard.KEYCODE_CANCEL:
if (mOptionsDialog == null || !mOptionsDialog.isShowing()) {
handleClose();
}
break;
case AnyKeyboardView.KEYCODE_OPTIONS:
showOptionsMenu();
break;
case AnyKeyboard.KEYCODE_SMILEY:
if (mSmileyOnShortPress) {
onText(mConfig.getSmileyText());
}
 else {
if (mInputView != null) mInputView.simulateLongPress(AnyKeyboard.KEYCODE_SMILEY);
}
break;
case AnyKeyboardView.KEYCODE_SMILEY_LONGPRESS:
if (mSmileyOnShortPress) {
if (mInputView != null) mInputView.simulateLongPress(AnyKeyboard.KEYCODE_SMILEY);
}
 else {
onText(mConfig.getSmileyText());
}
break;
case Keyboard.KEYCODE_MODE_CHANGE:
nextKeyboard(getCurrentInputEditorInfo(),NextKeyboardType.Symbols);
break;
case AnyKeyboard.KEYCODE_LANG_CHANGE:
nextKeyboard(getCurrentInputEditorInfo(),NextKeyboardType.Alphabet);
break;
default :
primaryCode=translatePrimaryCodeFromCurrentKeyboard(primaryCode);
if (isWordSeparator(primaryCode)) {
handleSeparator(primaryCode);
if (primaryCode == KEYCODE_SPACE) {
if (DEBUG) Log.d("String_Node_Str","String_Node_Str" + mSwitchKeyboardOnSpace);
if (mSwitchKeyboardOnSpace && !mKeyboardSwitcher.isAlphabetMode()) {
AnyKeyboard currentKeyboard=mKeyboardSwitcher.getCurrentKeyboard();
currentKeyboard=mKeyboardSwitcher.nextKeyboard(getCurrentInputEditorInfo(),NextKeyboardType.Alphabet);
}
}
}
 else {
handleCharacter(primaryCode,keyCodes);
mSpaceSent=false;
}
mJustRevertedSeparator=null;
}
}