nus-yam/ex-repair huggingface dataset:
Program: 157507
Project: 157507
Buggy source:
public void onViewNotRequired(){
  if (AnyApplication.DEBUG)   Log.d(TAG,"String_Node_Str");
  AnyApplication.getConfig().removeChangedListener(this);
  unbindDrawable(mPreviewPopup.getBackground());
  unbindDrawable(getBackground());
  for (int i=0; i < mKeysIcons.size(); i++) {
    Drawable d=mKeysIcons.valueAt(i);
    unbindDrawable(d);
  }
  mKeysIcons.clear();
  mKeysIconBuilders.clear();
  unbindDrawable(mPreviewKeyBackground);
  unbindDrawable(mKeyBackground);
  mMiniKeyboardParent=null;
  if (mMiniKeyboard != null)   mMiniKeyboard.onViewNotRequired();
  mMiniKeyboard=null;
  mKeyboardActionListener=null;
  mKeyboard=null;
  closing();
}

Fixed version (ground truth):
public void onViewNotRequired(){
  if (AnyApplication.DEBUG)   Log.d(TAG,"String_Node_Str");
  AnyApplication.getConfig().removeChangedListener(this);
  unbindDrawable(mPreviewPopup.getBackground());
  unbindDrawable(getBackground());
  for (int i=0; i < mKeysIcons.size(); i++) {
    Drawable d=mKeysIcons.valueAt(i);
    unbindDrawable(d);
  }
  mKeysIcons.clear();
  mKeysIconBuilders.clear();
  unbindDrawable(mPreviewKeyBackground);
  unbindDrawable(mKeyBackground);
  mMiniKeyboardParent=null;
  if (mMiniKeyboard != null)   mMiniKeyboard.onViewNotRequired();
  mMiniKeyboard=null;
  mKeyboardActionListener=null;
  mGestureDetector=null;
  mKeyboard=null;
  closing();
}
Program: 157509
Project: 157509
Buggy source:
public synchronized EditableDictionary createUserDictionary(Context context,String locale){
  if (mUserDictionary != null && equalsString(mUserDictionaryLocale,locale)) {
    Log.d(TAG,"String_Node_Str" + mUserDictionaryLocale);
    return mUserDictionary;
  }
  Log.d(TAG,"String_Node_Str" + locale);
  mUserDictionary=new SafeUserDictionary(context,locale);
  mUserDictionary.loadDictionary();
  mUserDictionaryLocale=locale;
  return mUserDictionary;
}

Fixed version (ground truth):
public synchronized EditableDictionary createUserDictionary(Context context,String locale){
  if (mUserDictionary != null && equalsString(mUserDictionaryLocale,locale)) {
    Log.d(TAG,"String_Node_Str" + mUserDictionaryLocale);
    return mUserDictionary;
  }
  Log.d(TAG,"String_Node_Str" + locale);
  mUserDictionary=new SafeUserDictionary(context,locale);
  mUserDictionaryLocale=locale;
  return mUserDictionary;
}
Program: 157511
Project: 157511
Buggy source:
@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException {
  super.startElement(uri,localName,qName,attributes);
  if (localName.equals("String_Node_Str")) {
    inWord=true;
    word="String_Node_Str";
    freq=Integer.parseInt(attributes.getValue("String_Node_Str"));
  }
  if (localName.equals("String_Node_Str")) {
    String locale=attributes.getValue("String_Node_Str");
    EditableDictionary dictionary=DictionaryFactory.getInstance().createUserDictionary(getApplicationContext(),locale);
    Log.d(TAG,"String_Node_Str" + locale);
    if (dictionary != mCurrentDictionary && mCurrentDictionary != null)     mCurrentDictionary.close();
    mCurrentDictionary=dictionary;
  }
}

Fixed version (ground truth):
@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException {
  super.startElement(uri,localName,qName,attributes);
  if (localName.equals("String_Node_Str")) {
    inWord=true;
    word="String_Node_Str";
    freq=Integer.parseInt(attributes.getValue("String_Node_Str"));
  }
  if (localName.equals("String_Node_Str")) {
    String locale=attributes.getValue("String_Node_Str");
    EditableDictionary dictionary=new SafeUserDictionary(getApplicationContext(),locale);
    Log.d(TAG,"String_Node_Str" + locale);
    if (dictionary != mCurrentDictionary && mCurrentDictionary != null)     mCurrentDictionary.close();
    mCurrentDictionary=dictionary;
    mCurrentDictionary.loadDictionary();
  }
}
Program: 157512
Project: 157512
Buggy source:
public void fillWordsList(){
  Log.d(TAG,"String_Node_Str" + mSelectedLocale);
  new UserWordsEditorAsyncTask(this){
    private EditableDictionary mNewDictionary;
    @Override protected void onPreExecute(){
      super.onPreExecute();
      mNewDictionary=DictionaryFactory.getInstance().createUserDictionary(getApplicationContext(),mSelectedLocale);
    }
    @Override protected Void doInBackground(    Void... params){
      try {
        if (mNewDictionary != mCurrentDictionary && mCurrentDictionary != null) {
          mCursor.close();
          mCurrentDictionary.close();
        }
        mCurrentDictionary=mNewDictionary;
        mCursor=mCurrentDictionary.getWordsCursor();
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      return null;
    }
    @Override protected void applyResults(    Void result){
      MyAdapter adapter=(MyAdapter)getListAdapter();
      if (adapter == null) {
        if (AnyApplication.DEBUG)         Log.d(TAG,"String_Node_Str");
        adapter=new MyAdapter();
        setListAdapter(adapter);
      }
 else {
        if (AnyApplication.DEBUG)         Log.d(TAG,"String_Node_Str");
        adapter.changeCursor(mCursor.getCursor());
      }
    }
  }
.execute();
}

Fixed version (ground truth):
public void fillWordsList(){
  Log.d(TAG,"String_Node_Str" + mSelectedLocale);
  new UserWordsEditorAsyncTask(this){
    private EditableDictionary mNewDictionary;
    @Override protected void onPreExecute(){
      super.onPreExecute();
      mNewDictionary=new SafeUserDictionary(getApplicationContext(),mSelectedLocale);
      mNewDictionary.loadDictionary();
      if (mNewDictionary != mCurrentDictionary && mCurrentDictionary != null) {
        mCursor.close();
        mCurrentDictionary.close();
      }
    }
    @Override protected Void doInBackground(    Void... params){
      try {
        mCurrentDictionary=mNewDictionary;
        mCursor=mCurrentDictionary.getWordsCursor();
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      return null;
    }
    @Override protected void applyResults(    Void result){
      MyAdapter adapter=(MyAdapter)getListAdapter();
      if (AnyApplication.DEBUG)       Log.d(TAG,"String_Node_Str");
      adapter=new MyAdapter();
      setListAdapter(adapter);
    }
  }
.execute();
}
Program: 157513
Project: 157513
Buggy source:
@Override protected Void doInBackground(Void... v){
  loadDictionaryAsync();
synchronized (mUpdatingLock) {
    mUpdatingDictionary=false;
  }
  return null;
}

Fixed version (ground truth):
@Override protected Void doInBackground(Void... v){
synchronized (mUpdatingLock) {
    mUpdatingDictionary=false;
  }
  return null;
}
Program: 157514
Project: 157514
Buggy source:
public AutoText createAutoText(){
  if (mAutoTextResId == INVALID_RES_ID)   return null;
 else   return new AutoText(getPackageContext().getResources(),mAutoTextResId);
}

Fixed version (ground truth):
public AutoText createAutoText(){
  if (mAutoTextResId == INVALID_RES_ID) {
    return null;
  }
 else {
    try {
      return new AutoText(getPackageContext().getResources(),mAutoTextResId);
    }
 catch (    OutOfMemoryError e) {
      Log.i(TAG,"String_Node_Str");
      return null;
    }
  }
}
Program: 157516
Project: 157516
Buggy source:
public void setKeyboardMode(int mode,EditorInfo attr){
  AnyKeyboard keyboard=null;
switch (mode) {
case MODE_DATETIME:
    keyboard=getSymbolsKeyboard(SYMBOLS_KEYBOARD_DATETIME_INDEX,getKeyboardMode(attr));
  mAlphabetMode=false;
mKeyboardLocked=true;
break;
case MODE_NUMBERS:
keyboard=getSymbolsKeyboard(SYMBOLS_KEYBOARD_NUMBERS_INDEX,getKeyboardMode(attr));
mAlphabetMode=false;
mKeyboardLocked=true;
break;
case MODE_SYMBOLS:
keyboard=getSymbolsKeyboard(SYMBOLS_KEYBOARD_REGULAR_INDEX,getKeyboardMode(attr));
mAlphabetMode=false;
mKeyboardLocked=true;
break;
case MODE_PHONE:
keyboard=getSymbolsKeyboard(SYMBOLS_KEYBOARD_PHONE_INDEX,getKeyboardMode(attr));
mAlphabetMode=false;
mKeyboardLocked=true;
break;
case MODE_URL:
case MODE_EMAIL:
if (mLatinKeyboardIndex >= 0) mLastSelectedKeyboard=mLatinKeyboardIndex;
default :
mKeyboardLocked=false;
keyboard=getAlphabetKeyboard(mLastSelectedKeyboard,getKeyboardMode(attr));
mAlphabetMode=true;
break;
}
keyboard.setImeOptions(mContext.getResources(),attr);
mContext.setKeyboardStuffBeforeSetToView(keyboard);
if (mInputView != null) {
mInputView.setKeyboard(keyboard);
}
}

Fixed version (ground truth):
public void setKeyboardMode(final int mode,final EditorInfo attr,final boolean restarting){
  AnyKeyboard keyboard=null;
switch (mode) {
case MODE_DATETIME:
    keyboard=getSymbolsKeyboard(SYMBOLS_KEYBOARD_DATETIME_INDEX,getKeyboardMode(attr));
  mAlphabetMode=false;
mKeyboardLocked=true;
break;
case MODE_NUMBERS:
keyboard=getSymbolsKeyboard(SYMBOLS_KEYBOARD_NUMBERS_INDEX,getKeyboardMode(attr));
mAlphabetMode=false;
mKeyboardLocked=true;
break;
case MODE_SYMBOLS:
keyboard=getSymbolsKeyboard(SYMBOLS_KEYBOARD_REGULAR_INDEX,getKeyboardMode(attr));
mAlphabetMode=false;
mKeyboardLocked=true;
break;
case MODE_PHONE:
keyboard=getSymbolsKeyboard(SYMBOLS_KEYBOARD_PHONE_INDEX,getKeyboardMode(attr));
mAlphabetMode=false;
mKeyboardLocked=true;
break;
case MODE_URL:
case MODE_EMAIL:
if (!restarting && mLatinKeyboardIndex >= 0) {
mLastSelectedKeyboard=mLatinKeyboardIndex;
}
default :
mKeyboardLocked=false;
keyboard=getAlphabetKeyboard(mLastSelectedKeyboard,getKeyboardMode(attr));
mAlphabetMode=true;
break;
}
keyboard.setImeOptions(mContext.getResources(),attr);
mContext.setKeyboardStuffBeforeSetToView(keyboard);
if (mInputView != null) {
mInputView.setKeyboard(keyboard);
}
}
Program: 157517
Project: 157517
Buggy source:
public static void onPackageChanged(final Intent eventIntent,final AnySoftKeyboard ask){
  boolean cleared=false;
  boolean recreateView=false;
  for (  AddOnsFactory<?> factory : mActiveInstances) {
    try {
      if (factory.isEventRequiresCacheRefresh(eventIntent,ask.getApplicationContext())) {
        cleared=true;
        if (factory.isEventRequiresViewReset(eventIntent,ask.getApplicationContext()))         recreateView=true;
        if (AnyApplication.DEBUG)         Log.d("String_Node_Str",factory.getClass().getName() + "String_Node_Str" + recreateView);
        factory.clearAddOnList();
      }
    }
 catch (    NameNotFoundException e) {
      e.printStackTrace();
    }
  }
  if (cleared)   ask.resetKeyboardView(recreateView);
}

Fixed version (ground truth):
public static void onPackageChanged(final Intent eventIntent,final AnySoftKeyboard ask){
  boolean cleared=false;
  boolean recreateView=false;
  for (  AddOnsFactory<?> factory : mActiveInstances) {
    try {
      if (factory.isEventRequiresCacheRefresh(eventIntent,ask.getApplicationContext())) {
        cleared=true;
        if (factory.isEventRequiresViewReset(eventIntent,ask.getApplicationContext()))         recreateView=true;
        Log.d(sTAG,factory.getClass().getName() + "String_Node_Str" + recreateView);
        factory.clearAddOnList();
      }
    }
 catch (    NameNotFoundException e) {
      e.printStackTrace();
    }
  }
  if (cleared)   ask.resetKeyboardView(recreateView);
}
Program: 157518
Project: 157518
Buggy source:
@Override protected void onPrepareDialogBuilder(Builder builder){
  ListAdapter listAdapter=new AddOnArrayAdapter(getContext(),R.layout.addon_list_item_pref,mAddOns);
  builder.setAdapter(listAdapter,this);
  super.onPrepareDialogBuilder(builder);
}

Fixed version (ground truth):
@Override protected void onPrepareDialogBuilder(Builder builder){
  if (mAddOns != null) {
    ListAdapter listAdapter=new AddOnArrayAdapter(getContext(),R.layout.addon_list_item_pref,mAddOns);
    builder.setAdapter(listAdapter,this);
  }
  super.onPrepareDialogBuilder(builder);
}
Program: 157520
Project: 157520
Buggy source:
private boolean pickDefaultSuggestion(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mBestWord);
  if (mHandler.hasMessages(MSG_UPDATE_SUGGESTIONS)) {
    postUpdateSuggestionsNow();
  }
  if (!TextUtils.isEmpty(mBestWord)) {
    TextEntryState.acceptedDefault(mWord.getTypedWord(),mBestWord);
    pickSuggestion(mBestWord,false);
    addToDictionaries(mBestWord,AutoDictionary.FREQUENCY_FOR_TYPED);
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean pickDefaultSuggestion(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + mBestWord);
  if (mHandler.hasMessages(MSG_UPDATE_SUGGESTIONS)) {
    performUpdateSuggestions();
  }
  if (!TextUtils.isEmpty(mBestWord)) {
    TextEntryState.acceptedDefault(mWord.getTypedWord(),mBestWord);
    pickSuggestion(mBestWord,false);
    addToDictionaries(mBestWord,AutoDictionary.FREQUENCY_FOR_TYPED);
    return true;
  }
  return false;
}
Program: 157521
Project: 157521
Buggy source:
private void commitTyped(InputConnection inputConnection){
  if (mPredicting) {
    mPredicting=false;
    if (mWord.size() > 0) {
      if (inputConnection != null) {
        inputConnection.commitText(mWord.getTypedWord(),1);
      }
      mCommittedLength=mWord.size();
      TextEntryState.acceptedTyped(mWord.getTypedWord());
      addToDictionaries(mWord.getTypedWord(),AutoDictionary.FREQUENCY_FOR_TYPED);
    }
    postUpdateSuggestionsNow();
  }
}

Fixed version (ground truth):
private void commitTyped(InputConnection inputConnection){
  if (mPredicting) {
    mPredicting=false;
    if (mWord.size() > 0) {
      if (inputConnection != null) {
        inputConnection.commitText(mWord.getTypedWord(),1);
      }
      mCommittedLength=mWord.size();
      TextEntryState.acceptedTyped(mWord.getTypedWord());
      addToDictionaries(mWord.getTypedWord(),AutoDictionary.FREQUENCY_FOR_TYPED);
    }
    if (mHandler.hasMessages(MSG_UPDATE_SUGGESTIONS)) {
      performUpdateSuggestions();
    }
  }
}
Program: 157522
Project: 157522
Buggy source:
protected void onPostExecute(Void result){
  progresDialog.dismiss();
  applyResults(result);
}

Fixed version (ground truth):
protected void onPostExecute(Void result){
  if (progresDialog.isShowing())   progresDialog.dismiss();
  applyResults(result);
}
Program: 157523
Project: 157523
Buggy source:
@Override public void onUpdateSelection(int oldSelStart,int oldSelEnd,int newSelStart,int newSelEnd,int candidatesStart,int candidatesEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,candidatesStart,candidatesEnd);
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ candidatesStart+ "String_Node_Str"+ candidatesEnd);
  }
  if (!mPredictionOn)   return;
  if (mPredicting && mWord.size() > 0 && (candidatesEnd - candidatesStart) != mWord.size()) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + mWord.size());
    return;
  }
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  if (newSelStart != newSelEnd) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    abortCorrection(true,false);
  }
 else {
    if (mPredicting) {
      if (newSelStart >= candidatesStart && newSelStart <= candidatesEnd) {
        int cursorPosition=newSelEnd - candidatesStart;
        if (mWord.setCursorPostion(cursorPosition)) {
          if (DEBUG)           Log.d(TAG,"String_Node_Str");
          updateShiftKeyState(getCurrentInputEditorInfo());
        }
      }
 else {
        if (DEBUG)         Log.d(TAG,"String_Node_Str");
        abortCorrection(true,false);
        postRestartWordSuggestion();
      }
    }
 else {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      postRestartWordSuggestion();
    }
  }
}

Fixed version (ground truth):
@Override public void onUpdateSelection(int oldSelStart,int oldSelEnd,int newSelStart,int newSelEnd,int candidatesStart,int candidatesEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,candidatesStart,candidatesEnd);
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ candidatesStart+ "String_Node_Str"+ candidatesEnd);
  }
  if (!mPredictionOn)   return;
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  if (newSelStart != newSelEnd) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    abortCorrection(true,false);
  }
 else {
    if (mPredicting) {
      if (newSelStart >= candidatesStart && newSelStart <= candidatesEnd) {
        int cursorPosition=newSelEnd - candidatesStart;
        if (mWord.setCursorPostion(cursorPosition)) {
          if (DEBUG)           Log.d(TAG,"String_Node_Str");
          updateShiftKeyState(getCurrentInputEditorInfo());
        }
      }
 else {
        if (DEBUG)         Log.d(TAG,"String_Node_Str");
        abortCorrection(true,false);
        postRestartWordSuggestion();
      }
    }
 else {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      postRestartWordSuggestion();
    }
  }
}
Program: 157524
Project: 157524
Buggy source:
private void abortCorrection(boolean force,boolean forever){
  if (force || TextEntryState.isCorrecting()) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS);
    mHandler.removeMessages(MSG_RESTART_NEW_WORD_SUGGESTIONS);
    getCurrentInputConnection().finishComposingText();
    clearSuggestions();
    mWord.reset();
    mPredicting=false;
    mJustAddedAutoSpace=false;
    if (forever) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mPredictionOn=false;
      setCandidatesViewShown(false);
      if (mSuggest != null) {
        mSuggest.setCorrectionMode(false,false);
      }
    }
  }
}

Fixed version (ground truth):
private void abortCorrection(boolean force,boolean forever){
  if (force || TextEntryState.isCorrecting()) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS);
    mHandler.removeMessages(MSG_RESTART_NEW_WORD_SUGGESTIONS);
    final InputConnection ic=getCurrentInputConnection();
    if (ic != null)     ic.finishComposingText();
    clearSuggestions();
    TextEntryState.reset();
    mWord.reset();
    mPredicting=false;
    mJustAddedAutoSpace=false;
    if (forever) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mPredictionOn=false;
      setCandidatesViewShown(false);
      if (mSuggest != null) {
        mSuggest.setCorrectionMode(false,false);
      }
    }
  }
}
Program: 157525
Project: 157525
Buggy source:
protected boolean isPackageContainAnAddon(Context context,String packageNameSchemePart) throws NameNotFoundException {
  PackageInfo newPackage=context.getPackageManager().getPackageInfo(packageNameSchemePart,PackageManager.GET_RECEIVERS);
  if (newPackage.receivers != null) {
    ActivityInfo[] receivers=newPackage.receivers;
    for (    ActivityInfo aReceiver : receivers) {
      final XmlPullParser xml=aReceiver.loadXmlMetaData(context.getPackageManager(),RECEIVER_META_DATA);
      if (xml != null) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean isPackageContainAnAddon(Context context,String packageNameSchemePart) throws NameNotFoundException {
  PackageInfo newPackage=context.getPackageManager().getPackageInfo(packageNameSchemePart,PackageManager.GET_RECEIVERS + PackageManager.GET_META_DATA);
  if (newPackage.receivers != null) {
    ActivityInfo[] receivers=newPackage.receivers;
    for (    ActivityInfo aReceiver : receivers) {
      final XmlPullParser xml=aReceiver.loadXmlMetaData(context.getPackageManager(),RECEIVER_META_DATA);
      if (xml != null) {
        return true;
      }
    }
  }
  return false;
}
Program: 157526
Project: 157526
Buggy source:
@Override public boolean onKeyUp(int keyCode,KeyEvent event){
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP:
    if (AnySoftKeyboard.getInstance().isInputViewShown() == false) {
      return super.onKeyUp(keyCode,event);
    }
  if (mConfig.useVolumeKeyForLeftRight()) {
    return true;
  }
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (mInputView != null && mInputView.isShown() && mInputView.isShifted()) {
  event=new KeyEvent(event.getDownTime(),event.getEventTime(),event.getAction(),event.getKeyCode(),event.getRepeatCount(),event.getDeviceId(),event.getScanCode(),KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_ON);
  InputConnection ic=getCurrentInputConnection();
  if (ic != null)   ic.sendKeyEvent(event);
  return true;
}
break;
case KeyEvent.KEYCODE_ALT_LEFT:
case KeyEvent.KEYCODE_ALT_RIGHT:
case KeyEvent.KEYCODE_SHIFT_LEFT:
case KeyEvent.KEYCODE_SHIFT_RIGHT:
case KeyEvent.KEYCODE_SYM:
mMetaState=MyMetaKeyKeyListener.handleKeyUp(mMetaState,keyCode,event);
if (DEBUG) Log.d("String_Node_Str",getMetaKeysStates("String_Node_Str"));
setInputConnectionMetaStateAsCurrentMetaKeyKeyListenerState();
break;
}
return super.onKeyUp(keyCode,event);
}

Fixed version (ground truth):
@Override public boolean onKeyUp(int keyCode,KeyEvent event){
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP:
    if (isInputViewShown() == false) {
      return super.onKeyUp(keyCode,event);
    }
  if (mConfig.useVolumeKeyForLeftRight()) {
    updateShiftKeyState(getCurrentInputEditorInfo());
    return true;
  }
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (mInputView != null && mInputView.isShown() && mInputView.isShifted()) {
  event=new KeyEvent(event.getDownTime(),event.getEventTime(),event.getAction(),event.getKeyCode(),event.getRepeatCount(),event.getDeviceId(),event.getScanCode(),KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_ON);
  InputConnection ic=getCurrentInputConnection();
  if (ic != null)   ic.sendKeyEvent(event);
  updateShiftKeyState(getCurrentInputEditorInfo());
  return true;
}
break;
case KeyEvent.KEYCODE_ALT_LEFT:
case KeyEvent.KEYCODE_ALT_RIGHT:
case KeyEvent.KEYCODE_SHIFT_LEFT:
case KeyEvent.KEYCODE_SHIFT_RIGHT:
case KeyEvent.KEYCODE_SYM:
mMetaState=MyMetaKeyKeyListener.handleKeyUp(mMetaState,keyCode,event);
if (DEBUG) Log.d("String_Node_Str",getMetaKeysStates("String_Node_Str"));
setInputConnectionMetaStateAsCurrentMetaKeyKeyListenerState();
break;
}
boolean r=super.onKeyUp(keyCode,event);
updateShiftKeyState(getCurrentInputEditorInfo());
return r;
}
Program: 157527
Project: 157527
Buggy source:
private void handleShift(boolean reset){
  mHandler.removeMessages(MSG_UPDATE_SHIFT_STATE);
  if (mKeyboardSwitcher.isAlphabetMode()) {
    if (DEBUG) {
      final AnyKeyboard viewKeyboard=(AnyKeyboard)mInputView.getKeyboard();
      if (mCurrentKeyboard != viewKeyboard) {
        Log.e(TAG,"String_Node_Str");
      }
    }
    final boolean caps;
    if (reset) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mInputView.setShifted(false);
      caps=false;
    }
 else {
      if (!mInputView.isShifted()) {
        if (DEBUG)         Log.d(TAG,"String_Node_Str");
        mInputView.setShifted(true);
        caps=false;
      }
 else {
        if (mCurrentKeyboard.isShiftLocked()) {
          if (DEBUG)           Log.d(TAG,"String_Node_Str");
          mInputView.setShifted(false);
          caps=false;
        }
 else {
          if (DEBUG)           Log.d(TAG,"String_Node_Str");
          mInputView.setShifted(true);
          caps=true;
        }
      }
    }
    mCapsLock=caps;
    mCurrentKeyboard.setShiftLocked(mCapsLock);
  }
}

Fixed version (ground truth):
private void handleShift(boolean reset){
  if (mKeyboardSwitcher.isAlphabetMode()) {
    if (DEBUG) {
      final AnyKeyboard viewKeyboard=(AnyKeyboard)mInputView.getKeyboard();
      if (mCurrentKeyboard != viewKeyboard) {
        Log.e(TAG,"String_Node_Str");
      }
    }
    final boolean caps;
    if (reset) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mInputView.setShifted(false);
      caps=false;
    }
 else {
      if (!mInputView.isShifted()) {
        if (DEBUG)         Log.d(TAG,"String_Node_Str");
        mInputView.setShifted(true);
        caps=false;
      }
 else {
        if (mCurrentKeyboard.isShiftLocked()) {
          if (DEBUG)           Log.d(TAG,"String_Node_Str");
          mInputView.setShifted(false);
          caps=false;
        }
 else {
          if (DEBUG)           Log.d(TAG,"String_Node_Str");
          mInputView.setShifted(true);
          caps=true;
        }
      }
    }
    mCapsLock=caps;
    mCurrentKeyboard.setShiftLocked(mCapsLock);
  }
}
Program: 157528
Project: 157528
Buggy source:
public void onRelease(int primaryCode){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + primaryCode);
  final boolean distinctMultiTouch=mInputView.hasDistinctMultitouch();
  if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_SHIFT) {
    if (mShiftKeyState.isMomentary())     handleShift(true);
    mShiftKeyState.onRelease();
  }
  if (distinctMultiTouch && primaryCode == AnyKeyboard.KEYCODE_CTRL) {
    if (mControlKeyState.isMomentary())     handleControl(true);
    mControlKeyState.onRelease();
  }
}

Fixed version (ground truth):
public void onRelease(int primaryCode){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + primaryCode);
  final boolean distinctMultiTouch=mInputView.hasDistinctMultitouch();
  if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_SHIFT) {
    if (mShiftKeyState.isMomentary())     handleShift(true);
    mShiftKeyState.onRelease();
  }
  if (distinctMultiTouch && primaryCode == AnyKeyboard.KEYCODE_CTRL) {
    if (mControlKeyState.isMomentary())     handleControl(true);
    mControlKeyState.onRelease();
  }
  if (primaryCode != Keyboard.KEYCODE_SHIFT)   updateShiftKeyState(getCurrentInputEditorInfo());
}
Program: 157529
Project: 157529
Buggy source:
@Override public void onUpdateSelection(int oldSelStart,int oldSelEnd,int newSelStart,int newSelEnd,int candidatesStart,int candidatesEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,candidatesStart,candidatesEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ candidatesStart+ "String_Node_Str"+ candidatesEnd);
  }
  if ((((mComposing.length() > 0 && mPredicting)) && (newSelStart != candidatesEnd || newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart)) {
    mComposing.setLength(0);
    mPredicting=false;
    postUpdateSuggestions();
    TextEntryState.reset();
    InputConnection ic=getCurrentInputConnection();
    if (ic != null) {
      ic.finishComposingText();
    }
  }
 else   if (!mPredicting && !mJustAccepted) {
switch (TextEntryState.getState()) {
case ACCEPTED_DEFAULT:
      TextEntryState.reset();
case SPACE_AFTER_PICKED:
    mJustAddedAutoSpace=false;
  break;
}
}
mJustAccepted=false;
postUpdateShiftKeyState();
mLastSelectionStart=newSelStart;
mLastSelectionEnd=newSelEnd;
}

Fixed version (ground truth):
@Override public void onUpdateSelection(int oldSelStart,int oldSelEnd,int newSelStart,int newSelEnd,int candidatesStart,int candidatesEnd){
  super.onUpdateSelection(oldSelStart,oldSelEnd,newSelStart,newSelEnd,candidatesStart,candidatesEnd);
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str" + oldSelStart + "String_Node_Str"+ oldSelEnd+ "String_Node_Str"+ newSelStart+ "String_Node_Str"+ newSelEnd+ "String_Node_Str"+ candidatesStart+ "String_Node_Str"+ candidatesEnd);
  }
  if ((((mComposing.length() > 0 && mPredicting)) && (newSelStart != candidatesEnd || newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart)) {
    mComposing.setLength(0);
    mPredicting=false;
    postUpdateSuggestions();
    TextEntryState.reset();
    InputConnection ic=getCurrentInputConnection();
    if (ic != null) {
      ic.finishComposingText();
    }
  }
 else   if (!mPredicting && !mJustAccepted) {
switch (TextEntryState.getState()) {
case ACCEPTED_DEFAULT:
      TextEntryState.reset();
case SPACE_AFTER_PICKED:
    mJustAddedAutoSpace=false;
  break;
}
}
mJustAccepted=false;
updateShiftKeyState(getCurrentInputEditorInfo());
mLastSelectionStart=newSelStart;
mLastSelectionEnd=newSelEnd;
}
Program: 157530
Project: 157530
Buggy source:
public void updateShiftKeyState(EditorInfo attr){
  mHandler.removeMessages(MSG_UPDATE_SHIFT_STATE);
  InputConnection ic=getCurrentInputConnection();
  if (ic != null && attr != null && mKeyboardSwitcher.isAlphabetMode() && (mInputView != null)) {
    mInputView.setShifted(mShiftKeyState.isMomentary() || mCapsLock || getCursorCapsMode(ic,attr) != 0);
  }
}

Fixed version (ground truth):
public void updateShiftKeyState(EditorInfo attr){
  InputConnection ic=getCurrentInputConnection();
  if (ic != null && attr != null && mKeyboardSwitcher.isAlphabetMode() && (mInputView != null)) {
    mInputView.setShifted(mShiftKeyState.isMomentary() || mCapsLock || getCursorCapsMode(ic,attr) != 0);
  }
}
Program: 157531
Project: 157531
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MSG_UPDATE_SUGGESTIONS:
    performUpdateSuggestions();
  break;
case MSG_UPDATE_SHIFT_STATE:
updateShiftKeyState(getCurrentInputEditorInfo());
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MSG_UPDATE_SUGGESTIONS:
    performUpdateSuggestions();
  break;
default :
super.handleMessage(msg);
}
}
Program: 157532
Project: 157532
Buggy source:
/** 
 * Search array for an entry BEGINNING with key.
 * @param array the array to search over
 * @param key the string to search for
 * @return true if the key was found in the array
 */
private static boolean linearSearch(String listOfIme,final String key){
  String[] arrayOfIme=listOfIme.split("String_Node_Str");
  if (AnyApplication.DEBUG)   Log.d(TAG,"String_Node_Str" + listOfIme);
  for (  final String ime : arrayOfIme) {
    if (AnyApplication.DEBUG)     Log.d(TAG,"String_Node_Str" + ime + "String_Node_Str"+ key+ "String_Node_Str");
    if (ime.startsWith(key))     return true;
  }
  if (AnyApplication.DEBUG)   Log.d(TAG,"String_Node_Str" + key + "String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Search array for an entry BEGINNING with key.
 * @param array the array to search over
 * @param key the string to search for
 * @return true if the key was found in the array
 */
private static boolean linearSearch(String listOfIme,final String key){
  if (TextUtils.isEmpty(listOfIme) || TextUtils.isEmpty(key))   return false;
  if (AnyApplication.DEBUG)   Log.d(TAG,"String_Node_Str" + listOfIme);
  String[] arrayOfIme=listOfIme.split("String_Node_Str");
  if (arrayOfIme == null)   return false;
  for (  final String ime : arrayOfIme) {
    if (TextUtils.isEmpty(ime))     continue;
    if (AnyApplication.DEBUG)     Log.d(TAG,"String_Node_Str" + ime + "String_Node_Str"+ key+ "String_Node_Str");
    if (ime.startsWith(key))     return true;
  }
  if (AnyApplication.DEBUG)   Log.d(TAG,"String_Node_Str" + key + "String_Node_Str");
  return false;
}
Program: 157535
Project: 157535
Buggy source:
void setMainDictionaryForCurrentKeyboard(){
  if (mSuggest != null) {
    if (!mShowSuggestions) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mSuggest.setMainDictionary(null);
    }
 else {
      if ((mKeyboardSwitcher != null) && mKeyboardSwitcher.isAlphabetMode()) {
        AnyKeyboard currentKeyobard=mKeyboardSwitcher.getCurrentKeyboard();
        Dictionary dictionary=getDictionaryForKeyboard(currentKeyobard);
        mSuggest.setMainDictionary(dictionary);
      }
    }
  }
}

Fixed version (ground truth):
void setMainDictionaryForCurrentKeyboard(){
  if (mSuggest != null) {
    if (!mShowSuggestions) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      mSuggest.setMainDictionary(null);
      mSuggest.setUserDictionary(null);
    }
 else {
      if ((mKeyboardSwitcher != null) && mKeyboardSwitcher.isAlphabetMode()) {
        AnyKeyboard currentKeyobard=mKeyboardSwitcher.getCurrentKeyboard();
        String mappingSettingsKey=getDictionaryOverrideKey(currentKeyobard);
        String defaultDictionary=currentKeyobard.getDefaultDictionaryLocale();
        String dictionaryValue=getSharedPreferences().getString(mappingSettingsKey,null);
        Dictionary dictionary=null;
        if (dictionaryValue == null) {
          dictionary=DictionaryFactory.getInstance().getDictionaryByLanguage(currentKeyobard.getDefaultDictionaryLocale(),this);
        }
 else {
          if (AnySoftKeyboardConfiguration.DEBUG) {
            Log.d("String_Node_Str","String_Node_Str" + (defaultDictionary == null ? "String_Node_Str" : defaultDictionary) + "String_Node_Str"+ currentKeyobard.getKeyboardPrefId()+ "String_Node_Str"+ dictionaryValue+ "String_Node_Str");
          }
          dictionary=DictionaryFactory.getInstance().getDictionaryById(dictionaryValue,this);
        }
        mSuggest.setMainDictionary(dictionary);
        mUserDictionary=DictionaryFactory.getInstance().createUserDictionary(this,defaultDictionary);
        mSuggest.setUserDictionary(mUserDictionary);
      }
    }
  }
}
Program: 157536
Project: 157536
Buggy source:
private void initSuggest(){
  mSuggest=new Suggest(this);
  mSuggest.setCorrectionMode(mCorrectionMode);
  mUserDictionary=DictionaryFactory.getInstance().createUserDictionary(this);
  mSuggest.setUserDictionary(mUserDictionary);
  handleContactsDictionaryMember();
  handleAutoDictionaryMember();
  setMainDictionaryForCurrentKeyboard();
}

Fixed version (ground truth):
private void initSuggest(){
  mSuggest=new Suggest(this);
  mSuggest.setCorrectionMode(mCorrectionMode);
  handleContactsDictionaryMember();
  handleAutoDictionaryMember();
  setMainDictionaryForCurrentKeyboard();
}
Program: 157537
Project: 157537
Buggy source:
protected void AddWordToStorage(String word,int frequency){
  Words.addWord(mContext,word,frequency,Words.LOCALE_TYPE_CURRENT);
}

Fixed version (ground truth):
protected void AddWordToStorage(String word,int frequency){
  if (TextUtils.isEmpty(word)) {
    return;
  }
  if (frequency < 0)   frequency=0;
  if (frequency > 255)   frequency=255;
  ContentValues values=new ContentValues(4);
  values.put(Words.WORD,word);
  values.put(Words.FREQUENCY,frequency);
  values.put(Words.LOCALE,mLocale);
  values.put(Words.APP_ID,0);
  Uri result=mContext.getContentResolver().insert(Words.CONTENT_URI,values);
  Log.i(TAG,"String_Node_Str" + word + "String_Node_Str"+ result);
}
Program: 157538
Project: 157538
Buggy source:
public AndroidUserDictionary(AnyKeyboardContextProvider context){
  super("String_Node_Str",context);
}

Fixed version (ground truth):
public AndroidUserDictionary(AnyKeyboardContextProvider context,String locale){
  super("String_Node_Str",context);
  mLocale=locale;
}
Program: 157539
Project: 157539
Buggy source:
protected void loadDictionaryAsync(){
  Cursor cursor=mContext.getContentResolver().query(Words.CONTENT_URI,PROJECTION,null,null,null);
  if (cursor == null)   throw new RuntimeException("String_Node_Str");
  addWords(cursor);
  ContentResolver cres=mContext.getContentResolver();
  cres.registerContentObserver(Words.CONTENT_URI,true,mObserver=new ContentObserver(null){
    @Override public void onChange(    boolean self){
      mRequiresReload=true;
    }
  }
);
}

Fixed version (ground truth):
protected void loadDictionaryAsync(){
  Cursor cursor=mContext.getContentResolver().query(Words.CONTENT_URI,PROJECTION,"String_Node_Str" + Words.LOCALE + "String_Node_Str"+ Words.LOCALE+ "String_Node_Str",new String[]{mLocale},null);
  if (cursor == null)   throw new RuntimeException("String_Node_Str");
  addWords(cursor);
  ContentResolver cres=mContext.getContentResolver();
  cres.registerContentObserver(Words.CONTENT_URI,true,mObserver=new ContentObserver(null){
    @Override public void onChange(    boolean self){
      mRequiresReload=true;
    }
  }
);
}
Program: 157540
Project: 157540
Buggy source:
@Override protected void loadDictionaryAsync(){
  Cursor cursor=query(COLUMN_LOCALE + "String_Node_Str",new String[]{mLocale});
  try {
    if (cursor.moveToFirst()) {
      int wordIndex=cursor.getColumnIndex(COLUMN_WORD);
      int frequencyIndex=cursor.getColumnIndex(COLUMN_FREQUENCY);
      while (!cursor.isAfterLast()) {
        String word=cursor.getString(wordIndex);
        int frequency=cursor.getInt(frequencyIndex);
        if (word.length() < MAX_WORD_LENGTH) {
          super.addWord(word,frequency);
        }
        cursor.moveToNext();
      }
    }
  }
  finally {
    cursor.close();
  }
}

Fixed version (ground truth):
@Override protected void loadDictionaryAsync(){
  Cursor cursor=query(COLUMN_LOCALE + "String_Node_Str",new String[]{mLocale});
  try {
    if (cursor.moveToFirst()) {
      int wordIndex=cursor.getColumnIndex(COLUMN_WORD);
      int frequencyIndex=cursor.getColumnIndex(COLUMN_FREQUENCY);
      while (!cursor.isAfterLast()) {
        String word=cursor.getString(wordIndex);
        int frequency=cursor.getInt(frequencyIndex);
        if (word.length() < MAX_WORD_LENGTH) {
          addWordFromStorage(word,frequency);
        }
        cursor.moveToNext();
      }
    }
  }
  finally {
    cursor.close();
  }
}
Program: 157542
Project: 157542
Buggy source:
public abstract void loadDictionary() throws Exception ;

Fixed version (ground truth):
public abstract void loadDictionary();
Program: 157543
Project: 157543
Buggy source:
public synchronized AddableDictionary createUserDictionary(AnyKeyboardContextProvider context){
  if (mUserDictionary != null) {
    return mUserDictionary;
  }
  mUserDictionary=new SafeUserDictionary(context);
  return mUserDictionary;
}

Fixed version (ground truth):
public synchronized AddableDictionary createUserDictionary(AnyKeyboardContextProvider context,String locale){
  if (mUserDictionary != null && equalsString(mUserDictionaryLocale,locale)) {
    return mUserDictionary;
  }
  mUserDictionary=new SafeUserDictionary(context,locale);
  mUserDictionary.loadDictionary();
  mUserDictionaryLocale=locale;
  return mUserDictionary;
}
Program: 157544
Project: 157544
Buggy source:
public synchronized AutoDictionary createAutoDictionary(AnyKeyboardContextProvider context,AnySoftKeyboard ime,String currentAutoDictionaryLocale){
  if (mAutoDictionary != null && equalsString(mAutoDictionary.getLocale(),currentAutoDictionaryLocale)) {
    return mAutoDictionary;
  }
  Log.d(TAG,"String_Node_Str" + currentAutoDictionaryLocale);
  mAutoDictionary=new AutoDictionary(context,ime,currentAutoDictionaryLocale);
  return mAutoDictionary;
}

Fixed version (ground truth):
public synchronized AutoDictionary createAutoDictionary(AnyKeyboardContextProvider context,AnySoftKeyboard ime,String currentAutoDictionaryLocale){
  if (mAutoDictionary != null && equalsString(mAutoDictionary.getLocale(),currentAutoDictionaryLocale)) {
    return mAutoDictionary;
  }
  Log.d(TAG,"String_Node_Str" + currentAutoDictionaryLocale);
  mAutoDictionary=new AutoDictionary(context,ime,currentAutoDictionaryLocale);
  mAutoDictionary.loadDictionary();
  return mAutoDictionary;
}
Program: 157545
Project: 157545
Buggy source:
public void loadDictionary(){
synchronized (mUpdatingLock) {
    startDictionaryLoadingTaskLocked();
  }
}

Fixed version (ground truth):
public void loadDictionary(){
synchronized (mUpdatingLock) {
    if (!mUpdatingDictionary) {
      mUpdatingDictionary=true;
      new LoadDictionaryTask().execute();
    }
  }
}
Program: 157546
Project: 157546
Buggy source:
protected SafeUserDictionary(AnyKeyboardContextProvider context){
  super("String_Node_Str");
  mAnyContext=context;
}

Fixed version (ground truth):
protected SafeUserDictionary(AnyKeyboardContextProvider context,String locale){
  super("String_Node_Str");
  mLocale=locale;
  mAnyContext=context;
}
Program: 157547
Project: 157547
Buggy source:
private void loadDictionaryAsync(){
  try {
    AndroidUserDictionary androidBuiltIn=new AndroidUserDictionary(mAnyContext);
    androidBuiltIn.loadDictionary();
    mActualDictionary=androidBuiltIn;
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str");
    FallbackUserDictionary fallback=new FallbackUserDictionary(mAnyContext);
    fallback.loadDictionary();
  }
}

Fixed version (ground truth):
private void loadDictionaryAsync(){
  try {
    AndroidUserDictionary androidBuiltIn=new AndroidUserDictionary(mAnyContext,mLocale);
    androidBuiltIn.loadDictionary();
    mActualDictionary=androidBuiltIn;
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str");
    FallbackUserDictionary fallback=new FallbackUserDictionary(mAnyContext);
    fallback.loadDictionary();
    mActualDictionary=fallback;
  }
}
Program: 157549
Project: 157549
Buggy source:
private void swapPunctuationAndSpace(){
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  CharSequence lastTwo=ic.getTextBeforeCursor(2,0);
  if (lastTwo != null && lastTwo.length() == 2 && lastTwo.charAt(0) == KEYCODE_SPACE && SPACE_SWAP_CHARACTERS.contains(String.valueOf(lastTwo.charAt(1)))) {
    ic.beginBatchEdit();
    ic.deleteSurroundingText(2,0);
    ic.commitText(lastTwo.charAt(1) + "String_Node_Str",1);
    ic.endBatchEdit();
    updateShiftKeyState(getCurrentInputEditorInfo());
  }
}

Fixed version (ground truth):
private void swapPunctuationAndSpace(){
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  CharSequence lastTwo=ic.getTextBeforeCursor(2,0);
  if (lastTwo != null && lastTwo.length() == 2 && lastTwo.charAt(0) == KEYCODE_SPACE && SPACE_SWAP_CHARACTERS.contains((int)lastTwo.charAt(1))) {
    ic.beginBatchEdit();
    ic.deleteSurroundingText(2,0);
    ic.commitText(lastTwo.charAt(1) + "String_Node_Str",1);
    ic.endBatchEdit();
    updateShiftKeyState(getCurrentInputEditorInfo());
  }
}
Program: 157550
Project: 157550
Buggy source:
@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  addPreferencesFromResource(R.layout.prefs);
  String version="String_Node_Str";
  try {
    final PackageInfo info=getPackageInfo(getApplicationContext());
    version=info.versionName + "String_Node_Str" + info.versionCode+ "String_Node_Str";
  }
 catch (  final NameNotFoundException e) {
    Log.e("String_Node_Str","String_Node_Str");
  }
  final Preference label=super.findPreference("String_Node_Str");
  label.setSummary(label.getSummary() + version);
  final Preference searcher=(Preference)super.findPreference("String_Node_Str");
  searcher.setOnPreferenceClickListener(new OnPreferenceClickListener(){
    public boolean onPreferenceClick(    Preference preference){
      if (preference.getKey().equals("String_Node_Str")) {
        MainForm.searchMarketForAddons(SoftKeyboardSettings.this.getApplicationContext());
        return true;
      }
      return false;
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  addPreferencesFromResource(R.layout.prefs);
  final PreferenceCategory keyboards=(PreferenceCategory)super.findPreference("String_Node_Str");
  default_preference_count=keyboards.getPreferenceCount();
  String version="String_Node_Str";
  try {
    final PackageInfo info=getPackageInfo(getApplicationContext());
    version=info.versionName + "String_Node_Str" + info.versionCode+ "String_Node_Str";
  }
 catch (  final NameNotFoundException e) {
    Log.e("String_Node_Str","String_Node_Str");
  }
  final Preference label=super.findPreference("String_Node_Str");
  label.setSummary(label.getSummary() + version);
  final Preference searcher=(Preference)super.findPreference("String_Node_Str");
  searcher.setOnPreferenceClickListener(new OnPreferenceClickListener(){
    public boolean onPreferenceClick(    Preference preference){
      if (preference.getKey().equals("String_Node_Str")) {
        MainForm.searchMarketForAddons(SoftKeyboardSettings.this.getApplicationContext());
        return true;
      }
      return false;
    }
  }
);
}
Program: 157551
Project: 157551
Buggy source:
@Override protected void onResume(){
  super.onResume();
  KeyboardBuildersFactory.resetBuildersCache();
  final ArrayList<KeyboardBuilder> creators=KeyboardBuildersFactory.getAllBuilders(getApplicationContext());
  final PreferenceCategory keyboards=(PreferenceCategory)super.findPreference("String_Node_Str");
  keyboards.removeAll();
  for (  final KeyboardBuilder creator : creators) {
    final Context creatorContext=creator.getPackageContext() == null ? getApplicationContext() : creator.getPackageContext();
    if (creatorContext == getApplicationContext() && creator.getKeyboardNameResId() == R.string.eng_keyboard) {
      continue;
    }
    final CheckBoxPreference checkBox=new CheckBoxPreference(getApplicationContext());
    checkBox.setKey(creator.getId());
    checkBox.setTitle(creatorContext.getText(creator.getKeyboardNameResId()));
    checkBox.setPersistent(true);
    checkBox.setDefaultValue(false);
    checkBox.setSummaryOn(creator.getDescription());
    checkBox.setSummaryOff(creator.getDescription());
    keyboards.addPreference(checkBox);
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  KeyboardBuildersFactory.resetBuildersCache();
  final ArrayList<KeyboardBuilder> creators=KeyboardBuildersFactory.getAllBuilders(getApplicationContext());
  final PreferenceCategory keyboards=(PreferenceCategory)super.findPreference("String_Node_Str");
  removeNonDefaultPreferences();
  for (  final KeyboardBuilder creator : creators) {
    final Context creatorContext=creator.getPackageContext() == null ? getApplicationContext() : creator.getPackageContext();
    if (creatorContext == getApplicationContext() && creator.getKeyboardNameResId() == R.string.eng_keyboard) {
      continue;
    }
    final CheckBoxPreference checkBox=new CheckBoxPreference(getApplicationContext());
    checkBox.setKey(creator.getId());
    checkBox.setTitle(creatorContext.getText(creator.getKeyboardNameResId()));
    checkBox.setPersistent(true);
    checkBox.setDefaultValue(false);
    checkBox.setSummaryOn(creator.getDescription());
    checkBox.setSummaryOff(creator.getDescription());
    keyboards.addPreference(checkBox);
  }
}
Program: 157552
Project: 157552
Buggy source:
private void longPressFirstWord(){
  mSelectedIndex=0;
  mSelectedString=mSuggestions.get(0);
  CharSequence suggestion=mService.pickSuggestionManually(mSelectedIndex,mSelectedString);
  mSelectedString=null;
  mSelectedIndex=OUT_OF_BOUNDS;
  if (mService.addWordToDictionary(suggestion.toString())) {
    showPreview(0,getContext().getResources().getString(R.string.added_word,suggestion));
  }
}

Fixed version (ground truth):
private void longPressFirstWord(){
  CharSequence word=mSuggestions.get(0);
  if (mService.addWordToDictionary(word.toString())) {
    showPreview(0,getContext().getResources().getString(R.string.added_word,word));
  }
}
Program: 157553
Project: 157553
Buggy source:
/** 
 * Add a new keystroke, with codes[0] containing the pressed key's unicode and the rest of the array containing unicode for adjacent keys, sorted by reducing probability/proximity.
 * @param codes the array of unicode values
 */
public void add(int primaryCode,int[] codes){
  mTypedWord.append(Character.toLowerCase((char)primaryCode));
  mCodes.add(codes);
  if (mTypedWord.length() == 1) {
    mIsCapitalized=Character.isUpperCase(primaryCode);
  }
}

Fixed version (ground truth):
/** 
 * Add a new keystroke, with codes[0] containing the pressed key's unicode and the rest of the array containing unicode for adjacent keys, sorted by reducing probability/proximity.
 * @param codes the array of unicode values
 */
public void add(int primaryCode,int[] codes){
  mTypedWord.append((char)primaryCode);
  mCodes.add(codes);
  if (mTypedWord.length() == 1) {
    mIsCapitalized=Character.isUpperCase(primaryCode);
  }
}
Program: 157554
Project: 157554
Buggy source:
public void append(CharSequence textToAdd){
  String loweredText=textToAdd.toString().toLowerCase();
  mTypedWord.append(loweredText);
  for (int i=0; i < loweredText.length(); i++) {
    char c=loweredText.charAt(i);
    mCodes.add(new int[]{c});
  }
}

Fixed version (ground truth):
public void append(CharSequence textToAdd){
  mTypedWord.append(textToAdd);
  int len=textToAdd.length();
  for (int i=0; i < len; i++) {
    char c=textToAdd.charAt(i);
    mCodes.add(new int[]{c});
  }
}