nus-yam/ex-repair huggingface dataset:
Program: 87953
Project: 87953
Buggy source:
/** 
 * Generates and writes a new binary dictionary based on the contents of the fusion dictionary.
 */
private void generateBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mSharedDictionaryController.mLastUpdateRequestTime + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  loadDictionaryAsync();
  final String tempFileName=mFilename + "String_Node_Str";
  final File file=new File(mContext.getFilesDir(),mFilename);
  final File tempFile=new File(mContext.getFilesDir(),tempFileName);
  FileOutputStream out=null;
  try {
    out=new FileOutputStream(tempFile);
    BinaryDictInputOutput.writeDictionaryBinary(out,mFusionDictionary,1);
    out.flush();
    out.close();
    tempFile.renameTo(file);
    clearFusionDictionary();
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
catch (  UnsupportedFormatException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates and writes a new binary dictionary based on the contents of the fusion dictionary.
 */
private void generateBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mFilename + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateRequestTime+ "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  loadDictionaryAsync();
  final String tempFileName=mFilename + "String_Node_Str";
  final File file=new File(mContext.getFilesDir(),mFilename);
  final File tempFile=new File(mContext.getFilesDir(),tempFileName);
  FileOutputStream out=null;
  try {
    out=new FileOutputStream(tempFile);
    BinaryDictInputOutput.writeDictionaryBinary(out,mFusionDictionary,1);
    out.flush();
    out.close();
    tempFile.renameTo(file);
    clearFusionDictionary();
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
catch (  UnsupportedFormatException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
      }
    }
  }
}
Program: 87954
Project: 87954
Buggy source:
@Override protected boolean hasContentChanged(){
  final long startTime=SystemClock.uptimeMillis();
  final int contactCount=getContactCount();
  if (contactCount > MAX_CONTACT_COUNT) {
    return false;
  }
  if (contactCount != sContactCountAtLastRebuild) {
    return true;
  }
  Cursor cursor=mContext.getContentResolver().query(Contacts.CONTENT_URI,PROJECTION,null,null,null);
  if (cursor != null) {
    try {
      if (cursor.moveToFirst()) {
        while (!cursor.isAfterLast()) {
          String name=cursor.getString(INDEX_NAME);
          if (isValidName(name) && !isNameInDictionary(name)) {
            if (DEBUG) {
              Log.d(TAG,"String_Node_Str" + name + "String_Node_Str"+ (SystemClock.uptimeMillis() - startTime)+ "String_Node_Str");
            }
            return true;
          }
          cursor.moveToNext();
        }
      }
    }
  finally {
      cursor.close();
    }
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + (SystemClock.uptimeMillis() - startTime) + "String_Node_Str");
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean hasContentChanged(){
  final long startTime=SystemClock.uptimeMillis();
  final int contactCount=getContactCount();
  if (contactCount > MAX_CONTACT_COUNT) {
    return false;
  }
  if (contactCount != sContactCountAtLastRebuild) {
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + sContactCountAtLastRebuild + "String_Node_Str"+ contactCount);
    }
    return true;
  }
  Cursor cursor=mContext.getContentResolver().query(Contacts.CONTENT_URI,PROJECTION,null,null,null);
  if (cursor != null) {
    try {
      if (cursor.moveToFirst()) {
        while (!cursor.isAfterLast()) {
          String name=cursor.getString(INDEX_NAME);
          if (isValidName(name) && !isNameInDictionary(name)) {
            if (DEBUG) {
              Log.d(TAG,"String_Node_Str" + name + "String_Node_Str"+ (SystemClock.uptimeMillis() - startTime)+ "String_Node_Str");
            }
            return true;
          }
          cursor.moveToNext();
        }
      }
    }
  finally {
      cursor.close();
    }
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + (SystemClock.uptimeMillis() - startTime) + "String_Node_Str");
  }
  return false;
}
Program: 87955
Project: 87955
Buggy source:
/** 
 * Loads the current binary dictionary from internal storage. Assumes the dictionary file exists.
 */
protected void loadBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mSharedDictionaryController.mLastUpdateRequestTime + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  final File file=new File(mContext.getFilesDir(),mFilename);
  final String filename=file.getAbsolutePath();
  final long length=file.length();
  final BinaryDictionary newBinaryDictionary=new BinaryDictionary(mContext,filename,0,length,true,null);
  if (mBinaryDictionary != null) {
    final BinaryDictionary oldBinaryDictionary=mBinaryDictionary;
    mLocalDictionaryController.lock();
    mBinaryDictionary=newBinaryDictionary;
    mLocalDictionaryController.unlock();
    oldBinaryDictionary.close();
  }
 else {
    mBinaryDictionary=newBinaryDictionary;
  }
}

Fixed version (ground truth):
/** 
 * Loads the current binary dictionary from internal storage. Assumes the dictionary file exists.
 */
protected void loadBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mFilename + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateRequestTime+ "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  final File file=new File(mContext.getFilesDir(),mFilename);
  final String filename=file.getAbsolutePath();
  final long length=file.length();
  final BinaryDictionary newBinaryDictionary=new BinaryDictionary(mContext,filename,0,length,true,null);
  if (mBinaryDictionary != null) {
    final BinaryDictionary oldBinaryDictionary=mBinaryDictionary;
    mLocalDictionaryController.lock();
    mBinaryDictionary=newBinaryDictionary;
    mLocalDictionaryController.unlock();
    oldBinaryDictionary.close();
  }
 else {
    mBinaryDictionary=newBinaryDictionary;
  }
}
Program: 87956
Project: 87956
Buggy source:
@Override public void run(){
  syncReloadDictionaryIfRequired();
}

Fixed version (ground truth):
@Override public void run(){
  syncReloadDictionaryInternal();
}
Program: 87957
Project: 87957
Buggy source:
/** 
 * Reloads the dictionary if required. Reload will occur asynchronously in a separate thread.
 */
void asyncReloadDictionaryIfRequired(){
  new AsyncReloadDictionaryTask().start();
}

Fixed version (ground truth):
/** 
 * Reloads the dictionary if required. Reload will occur asynchronously in a separate thread.
 */
void asyncReloadDictionaryIfRequired(){
  if (!isReloadRequired())   return;
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mFilename);
  }
  new AsyncReloadDictionaryTask().start();
}
Program: 87958
Project: 87958
Buggy source:
/** 
 * Marks that the dictionary is out of date and requires a reload.
 * @param requiresRebuild Indicates that the source dictionary content has changed and a rebuildof the binary file is required. If not true, the next reload process will only read the current binary dictionary from file.
 */
protected void setRequiresReload(final boolean requiresRebuild){
  final long time=SystemClock.uptimeMillis();
  mLocalDictionaryController.mLastUpdateRequestTime=time;
  mSharedDictionaryController.mLastUpdateRequestTime=time;
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + time + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
}

Fixed version (ground truth):
/** 
 * Marks that the dictionary is out of date and requires a reload.
 * @param requiresRebuild Indicates that the source dictionary content has changed and a rebuildof the binary file is required. If not true, the next reload process will only read the current binary dictionary from file.
 */
protected void setRequiresReload(final boolean requiresRebuild){
  final long time=SystemClock.uptimeMillis();
  mLocalDictionaryController.mLastUpdateRequestTime=time;
  mSharedDictionaryController.mLastUpdateRequestTime=time;
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mFilename + "String_Node_Str"+ time+ "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
}
Program: 87959
Project: 87959
Buggy source:
/** 
 * Reloads the dictionary if required. Access is controlled on a per dictionary file basis and supports concurrent calls from multiple instances that share the same dictionary file.
 */
protected final void syncReloadDictionaryIfRequired(){
  if (mBinaryDictionary != null && !mLocalDictionaryController.isOutOfDate()) {
    return;
  }
  mSharedDictionaryController.lock();
  try {
    final long time=SystemClock.uptimeMillis();
    if (mSharedDictionaryController.isOutOfDate() || !dictionaryFileExists()) {
      if (hasContentChanged()) {
        mSharedDictionaryController.mLastUpdateTime=time;
        generateBinaryDictionary();
        loadBinaryDictionary();
      }
 else {
        mSharedDictionaryController.mLastUpdateRequestTime=mSharedDictionaryController.mLastUpdateTime;
      }
    }
 else     if (mBinaryDictionary == null || mLocalDictionaryController.mLastUpdateTime < mSharedDictionaryController.mLastUpdateTime) {
      loadBinaryDictionary();
    }
    mLocalDictionaryController.mLastUpdateTime=time;
  }
  finally {
    mSharedDictionaryController.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Reloads the dictionary if required.
 */
protected final void syncReloadDictionaryIfRequired(){
  if (!isReloadRequired())   return;
  syncReloadDictionaryInternal();
}
Program: 87960
Project: 87960
Buggy source:
/** 
 * Generates and writes a new binary dictionary based on the contents of the fusion dictionary.
 */
private void generateBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mSharedDictionaryController.mLastUpdateRequestTime + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  loadDictionaryAsync();
  final String tempFileName=mFilename + "String_Node_Str";
  final File file=new File(mContext.getFilesDir(),mFilename);
  final File tempFile=new File(mContext.getFilesDir(),tempFileName);
  FileOutputStream out=null;
  try {
    out=new FileOutputStream(tempFile);
    BinaryDictInputOutput.writeDictionaryBinary(out,mFusionDictionary,1);
    out.flush();
    out.close();
    tempFile.renameTo(file);
    clearFusionDictionary();
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
catch (  UnsupportedFormatException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates and writes a new binary dictionary based on the contents of the fusion dictionary.
 */
private void generateBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mFilename + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateRequestTime+ "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  loadDictionaryAsync();
  final String tempFileName=mFilename + "String_Node_Str";
  final File file=new File(mContext.getFilesDir(),mFilename);
  final File tempFile=new File(mContext.getFilesDir(),tempFileName);
  FileOutputStream out=null;
  try {
    out=new FileOutputStream(tempFile);
    BinaryDictInputOutput.writeDictionaryBinary(out,mFusionDictionary,1);
    out.flush();
    out.close();
    tempFile.renameTo(file);
    clearFusionDictionary();
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
catch (  UnsupportedFormatException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
      }
    }
  }
}
Program: 87961
Project: 87961
Buggy source:
@Override protected boolean hasContentChanged(){
  final long startTime=SystemClock.uptimeMillis();
  final int contactCount=getContactCount();
  if (contactCount > MAX_CONTACT_COUNT) {
    return false;
  }
  if (contactCount != sContactCountAtLastRebuild) {
    return true;
  }
  Cursor cursor=mContext.getContentResolver().query(Contacts.CONTENT_URI,PROJECTION,null,null,null);
  if (cursor != null) {
    try {
      if (cursor.moveToFirst()) {
        while (!cursor.isAfterLast()) {
          String name=cursor.getString(INDEX_NAME);
          if (isValidName(name) && !isNameInDictionary(name)) {
            if (DEBUG) {
              Log.d(TAG,"String_Node_Str" + name + "String_Node_Str"+ (SystemClock.uptimeMillis() - startTime)+ "String_Node_Str");
            }
            return true;
          }
          cursor.moveToNext();
        }
      }
    }
  finally {
      cursor.close();
    }
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + (SystemClock.uptimeMillis() - startTime) + "String_Node_Str");
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean hasContentChanged(){
  final long startTime=SystemClock.uptimeMillis();
  final int contactCount=getContactCount();
  if (contactCount > MAX_CONTACT_COUNT) {
    return false;
  }
  if (contactCount != sContactCountAtLastRebuild) {
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + sContactCountAtLastRebuild + "String_Node_Str"+ contactCount);
    }
    return true;
  }
  Cursor cursor=mContext.getContentResolver().query(Contacts.CONTENT_URI,PROJECTION,null,null,null);
  if (cursor != null) {
    try {
      if (cursor.moveToFirst()) {
        while (!cursor.isAfterLast()) {
          String name=cursor.getString(INDEX_NAME);
          if (isValidName(name) && !isNameInDictionary(name)) {
            if (DEBUG) {
              Log.d(TAG,"String_Node_Str" + name + "String_Node_Str"+ (SystemClock.uptimeMillis() - startTime)+ "String_Node_Str");
            }
            return true;
          }
          cursor.moveToNext();
        }
      }
    }
  finally {
      cursor.close();
    }
  }
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + (SystemClock.uptimeMillis() - startTime) + "String_Node_Str");
  }
  return false;
}
Program: 87962
Project: 87962
Buggy source:
/** 
 * Loads the current binary dictionary from internal storage. Assumes the dictionary file exists.
 */
protected void loadBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mSharedDictionaryController.mLastUpdateRequestTime + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  final File file=new File(mContext.getFilesDir(),mFilename);
  final String filename=file.getAbsolutePath();
  final long length=file.length();
  final BinaryDictionary newBinaryDictionary=new BinaryDictionary(mContext,filename,0,length,true,null);
  if (mBinaryDictionary != null) {
    final BinaryDictionary oldBinaryDictionary=mBinaryDictionary;
    mLocalDictionaryController.lock();
    mBinaryDictionary=newBinaryDictionary;
    mLocalDictionaryController.unlock();
    oldBinaryDictionary.close();
  }
 else {
    mBinaryDictionary=newBinaryDictionary;
  }
}

Fixed version (ground truth):
/** 
 * Loads the current binary dictionary from internal storage. Assumes the dictionary file exists.
 */
protected void loadBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mFilename + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateRequestTime+ "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  final File file=new File(mContext.getFilesDir(),mFilename);
  final String filename=file.getAbsolutePath();
  final long length=file.length();
  final BinaryDictionary newBinaryDictionary=new BinaryDictionary(mContext,filename,0,length,true,null);
  if (mBinaryDictionary != null) {
    final BinaryDictionary oldBinaryDictionary=mBinaryDictionary;
    mLocalDictionaryController.lock();
    mBinaryDictionary=newBinaryDictionary;
    mLocalDictionaryController.unlock();
    oldBinaryDictionary.close();
  }
 else {
    mBinaryDictionary=newBinaryDictionary;
  }
}
Program: 87963
Project: 87963
Buggy source:
@Override public void run(){
  syncReloadDictionaryIfRequired();
}

Fixed version (ground truth):
@Override public void run(){
  syncReloadDictionaryInternal();
}
Program: 87964
Project: 87964
Buggy source:
/** 
 * Reloads the dictionary if required. Reload will occur asynchronously in a separate thread.
 */
void asyncReloadDictionaryIfRequired(){
  new AsyncReloadDictionaryTask().start();
}

Fixed version (ground truth):
/** 
 * Reloads the dictionary if required. Reload will occur asynchronously in a separate thread.
 */
void asyncReloadDictionaryIfRequired(){
  if (!isReloadRequired())   return;
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mFilename);
  }
  new AsyncReloadDictionaryTask().start();
}
Program: 87965
Project: 87965
Buggy source:
/** 
 * Marks that the dictionary is out of date and requires a reload.
 * @param requiresRebuild Indicates that the source dictionary content has changed and a rebuildof the binary file is required. If not true, the next reload process will only read the current binary dictionary from file.
 */
protected void setRequiresReload(final boolean requiresRebuild){
  final long time=SystemClock.uptimeMillis();
  mLocalDictionaryController.mLastUpdateRequestTime=time;
  mSharedDictionaryController.mLastUpdateRequestTime=time;
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + time + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
}

Fixed version (ground truth):
/** 
 * Marks that the dictionary is out of date and requires a reload.
 * @param requiresRebuild Indicates that the source dictionary content has changed and a rebuildof the binary file is required. If not true, the next reload process will only read the current binary dictionary from file.
 */
protected void setRequiresReload(final boolean requiresRebuild){
  final long time=SystemClock.uptimeMillis();
  mLocalDictionaryController.mLastUpdateRequestTime=time;
  mSharedDictionaryController.mLastUpdateRequestTime=time;
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mFilename + "String_Node_Str"+ time+ "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
}
Program: 87966
Project: 87966
Buggy source:
/** 
 * Reloads the dictionary if required. Access is controlled on a per dictionary file basis and supports concurrent calls from multiple instances that share the same dictionary file.
 */
protected final void syncReloadDictionaryIfRequired(){
  if (mBinaryDictionary != null && !mLocalDictionaryController.isOutOfDate()) {
    return;
  }
  mSharedDictionaryController.lock();
  try {
    final long time=SystemClock.uptimeMillis();
    if (mSharedDictionaryController.isOutOfDate() || !dictionaryFileExists()) {
      if (hasContentChanged()) {
        mSharedDictionaryController.mLastUpdateTime=time;
        generateBinaryDictionary();
        loadBinaryDictionary();
      }
 else {
        mSharedDictionaryController.mLastUpdateRequestTime=mSharedDictionaryController.mLastUpdateTime;
      }
    }
 else     if (mBinaryDictionary == null || mLocalDictionaryController.mLastUpdateTime < mSharedDictionaryController.mLastUpdateTime) {
      loadBinaryDictionary();
    }
    mLocalDictionaryController.mLastUpdateTime=time;
  }
  finally {
    mSharedDictionaryController.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Reloads the dictionary if required.
 */
protected final void syncReloadDictionaryIfRequired(){
  if (!isReloadRequired())   return;
  syncReloadDictionaryInternal();
}
Program: 87967
Project: 87967
Buggy source:
/** 
 * Generates and writes a new binary dictionary based on the contents of the fusion dictionary.
 */
private void generateBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mSharedDictionaryController.mLastUpdateRequestTime + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  loadDictionaryAsync();
  final String tempFileName=mFilename + "String_Node_Str";
  final File file=new File(mContext.getFilesDir(),mFilename);
  final File tempFile=new File(mContext.getFilesDir(),tempFileName);
  FileOutputStream out=null;
  try {
    out=new FileOutputStream(tempFile);
    BinaryDictInputOutput.writeDictionaryBinary(out,mFusionDictionary,1);
    out.flush();
    out.close();
    tempFile.renameTo(file);
    clearFusionDictionary();
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
catch (  UnsupportedFormatException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates and writes a new binary dictionary based on the contents of the fusion dictionary.
 */
private void generateBinaryDictionary(){
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str" + mFilename + "String_Node_Str"+ mSharedDictionaryController.mLastUpdateRequestTime+ "String_Node_Str"+ mSharedDictionaryController.mLastUpdateTime);
  }
  loadDictionaryAsync();
  final String tempFileName=mFilename + "String_Node_Str";
  final File file=new File(mContext.getFilesDir(),mFilename);
  final File tempFile=new File(mContext.getFilesDir(),tempFileName);
  FileOutputStream out=null;
  try {
    out=new FileOutputStream(tempFile);
    BinaryDictInputOutput.writeDictionaryBinary(out,mFusionDictionary,1);
    out.flush();
    out.close();
    tempFile.renameTo(file);
    clearFusionDictionary();
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
catch (  UnsupportedFormatException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
      }
    }
  }
}
Program: 87968
Project: 87968
Buggy source:
private static boolean hasAutoCorrectionForConsideredWord(HashMap<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<SuggestedWordInfo> suggestions,CharSequence consideredWord){
  if (TextUtils.isEmpty(consideredWord))   return false;
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsToBeAutoCorrected(dictionaries,consideredWord,false);
}

Fixed version (ground truth):
private static boolean hasAutoCorrectionForConsideredWord(final ConcurrentHashMap<String,Dictionary> dictionaries,final WordComposer wordComposer,final ArrayList<SuggestedWordInfo> suggestions,final CharSequence consideredWord){
  if (TextUtils.isEmpty(consideredWord))   return false;
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsToBeAutoCorrected(dictionaries,consideredWord,false);
}
Program: 87969
Project: 87969
Buggy source:
public static boolean allowsToBeAutoCorrected(HashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  final WhitelistDictionary whitelistDictionary=(WhitelistDictionary)dictionaries.get(Suggest.DICT_KEY_WHITELIST);
  if (whitelistDictionary != null && whitelistDictionary.shouldForciblyAutoCorrectFrom(word)) {
    return true;
  }
  return !isValidWord(dictionaries,word,ignoreCase);
}

Fixed version (ground truth):
public static boolean allowsToBeAutoCorrected(final ConcurrentHashMap<String,Dictionary> dictionaries,final CharSequence word,final boolean ignoreCase){
  final WhitelistDictionary whitelistDictionary=(WhitelistDictionary)dictionaries.get(Suggest.DICT_KEY_WHITELIST);
  if (whitelistDictionary != null && whitelistDictionary.shouldForciblyAutoCorrectFrom(word)) {
    return true;
  }
  return !isValidWord(dictionaries,word,ignoreCase);
}
Program: 87970
Project: 87970
Buggy source:
public static CharSequence computeAutoCorrectionWord(HashMap<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<SuggestedWordInfo> suggestions,CharSequence consideredWord,float autoCorrectionThreshold,CharSequence whitelistedWord){
  if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
    return whitelistedWord;
  }
 else   if (hasAutoCorrectionForConsideredWord(dictionaries,wordComposer,suggestions,consideredWord)) {
    return consideredWord;
  }
 else   if (hasAutoCorrectionForBinaryDictionary(wordComposer,suggestions,consideredWord,autoCorrectionThreshold)) {
    return suggestions.get(0).mWord;
  }
  return null;
}

Fixed version (ground truth):
public static CharSequence computeAutoCorrectionWord(final ConcurrentHashMap<String,Dictionary> dictionaries,final WordComposer wordComposer,final ArrayList<SuggestedWordInfo> suggestions,final CharSequence consideredWord,final float autoCorrectionThreshold,final CharSequence whitelistedWord){
  if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
    return whitelistedWord;
  }
 else   if (hasAutoCorrectionForConsideredWord(dictionaries,wordComposer,suggestions,consideredWord)) {
    return consideredWord;
  }
 else   if (hasAutoCorrectionForBinaryDictionary(wordComposer,suggestions,consideredWord,autoCorrectionThreshold)) {
    return suggestions.get(0).mWord;
  }
  return null;
}
Program: 87971
Project: 87971
Buggy source:
public static boolean isValidWord(HashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  if (TextUtils.isEmpty(word)) {
    return false;
  }
  final CharSequence lowerCasedWord=word.toString().toLowerCase();
  for (  final String key : dictionaries.keySet()) {
    if (key.equals(Suggest.DICT_KEY_WHITELIST))     continue;
    final Dictionary dictionary=dictionaries.get(key);
    if (null == dictionary)     continue;
    if (dictionary.isValidWord(word) || (ignoreCase && dictionary.isValidWord(lowerCasedWord))) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isValidWord(final ConcurrentHashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  if (TextUtils.isEmpty(word)) {
    return false;
  }
  final CharSequence lowerCasedWord=word.toString().toLowerCase();
  for (  final String key : dictionaries.keySet()) {
    if (key.equals(Suggest.DICT_KEY_WHITELIST))     continue;
    final Dictionary dictionary=dictionaries.get(key);
    if (null == dictionary)     continue;
    if (dictionary.isValidWord(word) || (ignoreCase && dictionary.isValidWord(lowerCasedWord))) {
      return true;
    }
  }
  return false;
}
Program: 87972
Project: 87972
Buggy source:
private static void addOrReplaceDictionary(HashMap<String,Dictionary> dictionaries,String key,Dictionary dict){
  final Dictionary oldDict=(dict == null) ? dictionaries.remove(key) : dictionaries.put(key,dict);
  if (oldDict != null && dict != oldDict) {
    oldDict.close();
  }
}

Fixed version (ground truth):
private static void addOrReplaceDictionary(final ConcurrentHashMap<String,Dictionary> dictionaries,final String key,final Dictionary dict){
  final Dictionary oldDict=(dict == null) ? dictionaries.remove(key) : dictionaries.put(key,dict);
  if (oldDict != null && dict != oldDict) {
    oldDict.close();
  }
}
Program: 87973
Project: 87973
Buggy source:
public HashMap<String,Dictionary> getUnigramDictionaries(){
  return mUnigramDictionaries;
}

Fixed version (ground truth):
public ConcurrentHashMap<String,Dictionary> getUnigramDictionaries(){
  return mUnigramDictionaries;
}
Program: 87974
Project: 87974
Buggy source:
private static boolean hasAutoCorrectionForConsideredWord(HashMap<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<SuggestedWordInfo> suggestions,CharSequence consideredWord){
  if (TextUtils.isEmpty(consideredWord))   return false;
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsToBeAutoCorrected(dictionaries,consideredWord,false);
}

Fixed version (ground truth):
private static boolean hasAutoCorrectionForConsideredWord(final ConcurrentHashMap<String,Dictionary> dictionaries,final WordComposer wordComposer,final ArrayList<SuggestedWordInfo> suggestions,final CharSequence consideredWord){
  if (TextUtils.isEmpty(consideredWord))   return false;
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsToBeAutoCorrected(dictionaries,consideredWord,false);
}
Program: 87975
Project: 87975
Buggy source:
public static boolean allowsToBeAutoCorrected(HashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  final WhitelistDictionary whitelistDictionary=(WhitelistDictionary)dictionaries.get(Suggest.DICT_KEY_WHITELIST);
  if (whitelistDictionary != null && whitelistDictionary.shouldForciblyAutoCorrectFrom(word)) {
    return true;
  }
  return !isValidWord(dictionaries,word,ignoreCase);
}

Fixed version (ground truth):
public static boolean allowsToBeAutoCorrected(final ConcurrentHashMap<String,Dictionary> dictionaries,final CharSequence word,final boolean ignoreCase){
  final WhitelistDictionary whitelistDictionary=(WhitelistDictionary)dictionaries.get(Suggest.DICT_KEY_WHITELIST);
  if (whitelistDictionary != null && whitelistDictionary.shouldForciblyAutoCorrectFrom(word)) {
    return true;
  }
  return !isValidWord(dictionaries,word,ignoreCase);
}
Program: 87976
Project: 87976
Buggy source:
public static CharSequence computeAutoCorrectionWord(HashMap<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<SuggestedWordInfo> suggestions,CharSequence consideredWord,float autoCorrectionThreshold,CharSequence whitelistedWord){
  if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
    return whitelistedWord;
  }
 else   if (hasAutoCorrectionForConsideredWord(dictionaries,wordComposer,suggestions,consideredWord)) {
    return consideredWord;
  }
 else   if (hasAutoCorrectionForBinaryDictionary(wordComposer,suggestions,consideredWord,autoCorrectionThreshold)) {
    return suggestions.get(0).mWord;
  }
  return null;
}

Fixed version (ground truth):
public static CharSequence computeAutoCorrectionWord(final ConcurrentHashMap<String,Dictionary> dictionaries,final WordComposer wordComposer,final ArrayList<SuggestedWordInfo> suggestions,final CharSequence consideredWord,final float autoCorrectionThreshold,final CharSequence whitelistedWord){
  if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
    return whitelistedWord;
  }
 else   if (hasAutoCorrectionForConsideredWord(dictionaries,wordComposer,suggestions,consideredWord)) {
    return consideredWord;
  }
 else   if (hasAutoCorrectionForBinaryDictionary(wordComposer,suggestions,consideredWord,autoCorrectionThreshold)) {
    return suggestions.get(0).mWord;
  }
  return null;
}
Program: 87977
Project: 87977
Buggy source:
public static boolean isValidWord(HashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  if (TextUtils.isEmpty(word)) {
    return false;
  }
  final CharSequence lowerCasedWord=word.toString().toLowerCase();
  for (  final String key : dictionaries.keySet()) {
    if (key.equals(Suggest.DICT_KEY_WHITELIST))     continue;
    final Dictionary dictionary=dictionaries.get(key);
    if (null == dictionary)     continue;
    if (dictionary.isValidWord(word) || (ignoreCase && dictionary.isValidWord(lowerCasedWord))) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isValidWord(final ConcurrentHashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  if (TextUtils.isEmpty(word)) {
    return false;
  }
  final CharSequence lowerCasedWord=word.toString().toLowerCase();
  for (  final String key : dictionaries.keySet()) {
    if (key.equals(Suggest.DICT_KEY_WHITELIST))     continue;
    final Dictionary dictionary=dictionaries.get(key);
    if (null == dictionary)     continue;
    if (dictionary.isValidWord(word) || (ignoreCase && dictionary.isValidWord(lowerCasedWord))) {
      return true;
    }
  }
  return false;
}
Program: 87978
Project: 87978
Buggy source:
private static void addOrReplaceDictionary(HashMap<String,Dictionary> dictionaries,String key,Dictionary dict){
  final Dictionary oldDict=(dict == null) ? dictionaries.remove(key) : dictionaries.put(key,dict);
  if (oldDict != null && dict != oldDict) {
    oldDict.close();
  }
}

Fixed version (ground truth):
private static void addOrReplaceDictionary(final ConcurrentHashMap<String,Dictionary> dictionaries,final String key,final Dictionary dict){
  final Dictionary oldDict=(dict == null) ? dictionaries.remove(key) : dictionaries.put(key,dict);
  if (oldDict != null && dict != oldDict) {
    oldDict.close();
  }
}
Program: 87979
Project: 87979
Buggy source:
public HashMap<String,Dictionary> getUnigramDictionaries(){
  return mUnigramDictionaries;
}

Fixed version (ground truth):
public ConcurrentHashMap<String,Dictionary> getUnigramDictionaries(){
  return mUnigramDictionaries;
}
Program: 87980
Project: 87980
Buggy source:
private static boolean hasAutoCorrectionForConsideredWord(HashMap<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<SuggestedWordInfo> suggestions,CharSequence consideredWord){
  if (TextUtils.isEmpty(consideredWord))   return false;
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsToBeAutoCorrected(dictionaries,consideredWord,false);
}

Fixed version (ground truth):
private static boolean hasAutoCorrectionForConsideredWord(final ConcurrentHashMap<String,Dictionary> dictionaries,final WordComposer wordComposer,final ArrayList<SuggestedWordInfo> suggestions,final CharSequence consideredWord){
  if (TextUtils.isEmpty(consideredWord))   return false;
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsToBeAutoCorrected(dictionaries,consideredWord,false);
}
Program: 87981
Project: 87981
Buggy source:
public static boolean allowsToBeAutoCorrected(HashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  final WhitelistDictionary whitelistDictionary=(WhitelistDictionary)dictionaries.get(Suggest.DICT_KEY_WHITELIST);
  if (whitelistDictionary != null && whitelistDictionary.shouldForciblyAutoCorrectFrom(word)) {
    return true;
  }
  return !isValidWord(dictionaries,word,ignoreCase);
}

Fixed version (ground truth):
public static boolean allowsToBeAutoCorrected(final ConcurrentHashMap<String,Dictionary> dictionaries,final CharSequence word,final boolean ignoreCase){
  final WhitelistDictionary whitelistDictionary=(WhitelistDictionary)dictionaries.get(Suggest.DICT_KEY_WHITELIST);
  if (whitelistDictionary != null && whitelistDictionary.shouldForciblyAutoCorrectFrom(word)) {
    return true;
  }
  return !isValidWord(dictionaries,word,ignoreCase);
}
Program: 87982
Project: 87982
Buggy source:
public static CharSequence computeAutoCorrectionWord(HashMap<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<SuggestedWordInfo> suggestions,CharSequence consideredWord,float autoCorrectionThreshold,CharSequence whitelistedWord){
  if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
    return whitelistedWord;
  }
 else   if (hasAutoCorrectionForConsideredWord(dictionaries,wordComposer,suggestions,consideredWord)) {
    return consideredWord;
  }
 else   if (hasAutoCorrectionForBinaryDictionary(wordComposer,suggestions,consideredWord,autoCorrectionThreshold)) {
    return suggestions.get(0).mWord;
  }
  return null;
}

Fixed version (ground truth):
public static CharSequence computeAutoCorrectionWord(final ConcurrentHashMap<String,Dictionary> dictionaries,final WordComposer wordComposer,final ArrayList<SuggestedWordInfo> suggestions,final CharSequence consideredWord,final float autoCorrectionThreshold,final CharSequence whitelistedWord){
  if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
    return whitelistedWord;
  }
 else   if (hasAutoCorrectionForConsideredWord(dictionaries,wordComposer,suggestions,consideredWord)) {
    return consideredWord;
  }
 else   if (hasAutoCorrectionForBinaryDictionary(wordComposer,suggestions,consideredWord,autoCorrectionThreshold)) {
    return suggestions.get(0).mWord;
  }
  return null;
}
Program: 87983
Project: 87983
Buggy source:
public static boolean isValidWord(HashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  if (TextUtils.isEmpty(word)) {
    return false;
  }
  final CharSequence lowerCasedWord=word.toString().toLowerCase();
  for (  final String key : dictionaries.keySet()) {
    if (key.equals(Suggest.DICT_KEY_WHITELIST))     continue;
    final Dictionary dictionary=dictionaries.get(key);
    if (null == dictionary)     continue;
    if (dictionary.isValidWord(word) || (ignoreCase && dictionary.isValidWord(lowerCasedWord))) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isValidWord(final ConcurrentHashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  if (TextUtils.isEmpty(word)) {
    return false;
  }
  final CharSequence lowerCasedWord=word.toString().toLowerCase();
  for (  final String key : dictionaries.keySet()) {
    if (key.equals(Suggest.DICT_KEY_WHITELIST))     continue;
    final Dictionary dictionary=dictionaries.get(key);
    if (null == dictionary)     continue;
    if (dictionary.isValidWord(word) || (ignoreCase && dictionary.isValidWord(lowerCasedWord))) {
      return true;
    }
  }
  return false;
}
Program: 87984
Project: 87984
Buggy source:
private static void addOrReplaceDictionary(HashMap<String,Dictionary> dictionaries,String key,Dictionary dict){
  final Dictionary oldDict=(dict == null) ? dictionaries.remove(key) : dictionaries.put(key,dict);
  if (oldDict != null && dict != oldDict) {
    oldDict.close();
  }
}

Fixed version (ground truth):
private static void addOrReplaceDictionary(final ConcurrentHashMap<String,Dictionary> dictionaries,final String key,final Dictionary dict){
  final Dictionary oldDict=(dict == null) ? dictionaries.remove(key) : dictionaries.put(key,dict);
  if (oldDict != null && dict != oldDict) {
    oldDict.close();
  }
}
Program: 87985
Project: 87985
Buggy source:
public HashMap<String,Dictionary> getUnigramDictionaries(){
  return mUnigramDictionaries;
}

Fixed version (ground truth):
public ConcurrentHashMap<String,Dictionary> getUnigramDictionaries(){
  return mUnigramDictionaries;
}
Program: 87986
Project: 87986
Buggy source:
private static boolean hasAutoCorrectionForConsideredWord(HashMap<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<SuggestedWordInfo> suggestions,CharSequence consideredWord){
  if (TextUtils.isEmpty(consideredWord))   return false;
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsToBeAutoCorrected(dictionaries,consideredWord,false);
}

Fixed version (ground truth):
private static boolean hasAutoCorrectionForConsideredWord(final ConcurrentHashMap<String,Dictionary> dictionaries,final WordComposer wordComposer,final ArrayList<SuggestedWordInfo> suggestions,final CharSequence consideredWord){
  if (TextUtils.isEmpty(consideredWord))   return false;
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsToBeAutoCorrected(dictionaries,consideredWord,false);
}
Program: 87987
Project: 87987
Buggy source:
public static boolean allowsToBeAutoCorrected(HashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  final WhitelistDictionary whitelistDictionary=(WhitelistDictionary)dictionaries.get(Suggest.DICT_KEY_WHITELIST);
  if (whitelistDictionary != null && whitelistDictionary.shouldForciblyAutoCorrectFrom(word)) {
    return true;
  }
  return !isValidWord(dictionaries,word,ignoreCase);
}

Fixed version (ground truth):
public static boolean allowsToBeAutoCorrected(final ConcurrentHashMap<String,Dictionary> dictionaries,final CharSequence word,final boolean ignoreCase){
  final WhitelistDictionary whitelistDictionary=(WhitelistDictionary)dictionaries.get(Suggest.DICT_KEY_WHITELIST);
  if (whitelistDictionary != null && whitelistDictionary.shouldForciblyAutoCorrectFrom(word)) {
    return true;
  }
  return !isValidWord(dictionaries,word,ignoreCase);
}
Program: 87988
Project: 87988
Buggy source:
public static CharSequence computeAutoCorrectionWord(HashMap<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<SuggestedWordInfo> suggestions,CharSequence consideredWord,float autoCorrectionThreshold,CharSequence whitelistedWord){
  if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
    return whitelistedWord;
  }
 else   if (hasAutoCorrectionForConsideredWord(dictionaries,wordComposer,suggestions,consideredWord)) {
    return consideredWord;
  }
 else   if (hasAutoCorrectionForBinaryDictionary(wordComposer,suggestions,consideredWord,autoCorrectionThreshold)) {
    return suggestions.get(0).mWord;
  }
  return null;
}

Fixed version (ground truth):
public static CharSequence computeAutoCorrectionWord(final ConcurrentHashMap<String,Dictionary> dictionaries,final WordComposer wordComposer,final ArrayList<SuggestedWordInfo> suggestions,final CharSequence consideredWord,final float autoCorrectionThreshold,final CharSequence whitelistedWord){
  if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
    return whitelistedWord;
  }
 else   if (hasAutoCorrectionForConsideredWord(dictionaries,wordComposer,suggestions,consideredWord)) {
    return consideredWord;
  }
 else   if (hasAutoCorrectionForBinaryDictionary(wordComposer,suggestions,consideredWord,autoCorrectionThreshold)) {
    return suggestions.get(0).mWord;
  }
  return null;
}
Program: 87989
Project: 87989
Buggy source:
public static boolean isValidWord(HashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  if (TextUtils.isEmpty(word)) {
    return false;
  }
  final CharSequence lowerCasedWord=word.toString().toLowerCase();
  for (  final String key : dictionaries.keySet()) {
    if (key.equals(Suggest.DICT_KEY_WHITELIST))     continue;
    final Dictionary dictionary=dictionaries.get(key);
    if (null == dictionary)     continue;
    if (dictionary.isValidWord(word) || (ignoreCase && dictionary.isValidWord(lowerCasedWord))) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isValidWord(final ConcurrentHashMap<String,Dictionary> dictionaries,CharSequence word,boolean ignoreCase){
  if (TextUtils.isEmpty(word)) {
    return false;
  }
  final CharSequence lowerCasedWord=word.toString().toLowerCase();
  for (  final String key : dictionaries.keySet()) {
    if (key.equals(Suggest.DICT_KEY_WHITELIST))     continue;
    final Dictionary dictionary=dictionaries.get(key);
    if (null == dictionary)     continue;
    if (dictionary.isValidWord(word) || (ignoreCase && dictionary.isValidWord(lowerCasedWord))) {
      return true;
    }
  }
  return false;
}
Program: 87990
Project: 87990
Buggy source:
private static void addOrReplaceDictionary(HashMap<String,Dictionary> dictionaries,String key,Dictionary dict){
  final Dictionary oldDict=(dict == null) ? dictionaries.remove(key) : dictionaries.put(key,dict);
  if (oldDict != null && dict != oldDict) {
    oldDict.close();
  }
}

Fixed version (ground truth):
private static void addOrReplaceDictionary(final ConcurrentHashMap<String,Dictionary> dictionaries,final String key,final Dictionary dict){
  final Dictionary oldDict=(dict == null) ? dictionaries.remove(key) : dictionaries.put(key,dict);
  if (oldDict != null && dict != oldDict) {
    oldDict.close();
  }
}
Program: 87991
Project: 87991
Buggy source:
public HashMap<String,Dictionary> getUnigramDictionaries(){
  return mUnigramDictionaries;
}

Fixed version (ground truth):
public ConcurrentHashMap<String,Dictionary> getUnigramDictionaries(){
  return mUnigramDictionaries;
}
Program: 88000
Project: 88000
Buggy source:
protected boolean setDebugMode(final boolean mode){
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mLatinIME);
  final boolean previousDebugSetting=prefs.getBoolean(PREF_DEBUG_MODE,false);
  final SharedPreferences.Editor editor=prefs.edit();
  editor.putBoolean(PREF_DEBUG_MODE,true);
  editor.commit();
  return previousDebugSetting;
}

Fixed version (ground truth):
protected boolean setDebugMode(final boolean mode){
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mLatinIME);
  final boolean previousDebugSetting=prefs.getBoolean(PREF_DEBUG_MODE,false);
  final SharedPreferences.Editor editor=prefs.edit();
  editor.putBoolean(PREF_DEBUG_MODE,mode);
  editor.commit();
  return previousDebugSetting;
}
Program: 88001
Project: 88001
Buggy source:
protected boolean setDebugMode(final boolean mode){
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mLatinIME);
  final boolean previousDebugSetting=prefs.getBoolean(PREF_DEBUG_MODE,false);
  final SharedPreferences.Editor editor=prefs.edit();
  editor.putBoolean(PREF_DEBUG_MODE,true);
  editor.commit();
  return previousDebugSetting;
}

Fixed version (ground truth):
protected boolean setDebugMode(final boolean mode){
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mLatinIME);
  final boolean previousDebugSetting=prefs.getBoolean(PREF_DEBUG_MODE,false);
  final SharedPreferences.Editor editor=prefs.edit();
  editor.putBoolean(PREF_DEBUG_MODE,mode);
  editor.commit();
  return previousDebugSetting;
}
Program: 88002
Project: 88002
Buggy source:
public boolean isCursorTouchingWord(){
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return false;
  CharSequence before=ic.getTextBeforeCursor(1,0);
  CharSequence after=ic.getTextAfterCursor(1,0);
  if (!TextUtils.isEmpty(before) && !mSettingsValues.isWordSeparator(before.charAt(0))) {
    return true;
  }
  if (!TextUtils.isEmpty(after) && !mSettingsValues.isWordSeparator(after.charAt(0))) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean isCursorTouchingWord(){
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return false;
  CharSequence before=ic.getTextBeforeCursor(1,0);
  CharSequence after=ic.getTextAfterCursor(1,0);
  if (!TextUtils.isEmpty(before) && !mSettingsValues.isWordSeparator(before.charAt(0)) && !mSettingsValues.isSymbolExcludedFromWordSeparators(before.charAt(0))) {
    return true;
  }
  if (!TextUtils.isEmpty(after) && !mSettingsValues.isWordSeparator(after.charAt(0)) && !mSettingsValues.isSymbolExcludedFromWordSeparators(after.charAt(0))) {
    return true;
  }
  return false;
}
Program: 88003
Project: 88003
Buggy source:
private void handleLanguageSwitchKey(){
  final boolean includesOtherImes=!mSettingsValues.mIncludesOtherImesInLanguageSwitchList;
  final IBinder token=getWindow().getWindow().getAttributes().token;
  if (mShouldSwitchToLastSubtype) {
    final InputMethodSubtypeCompatWrapper lastSubtype=mImm.getLastInputMethodSubtype();
    final boolean lastSubtypeBelongsToThisIme=SubtypeUtils.checkIfSubtypeBelongsToThisIme(this,lastSubtype);
    if ((includesOtherImes || lastSubtypeBelongsToThisIme) && mImm.switchToLastInputMethod(token)) {
      mShouldSwitchToLastSubtype=false;
    }
 else {
      mImm.switchToNextInputMethod(token,!includesOtherImes);
      mShouldSwitchToLastSubtype=true;
    }
  }
 else {
    mImm.switchToNextInputMethod(token,!includesOtherImes);
  }
}

Fixed version (ground truth):
private void handleLanguageSwitchKey(){
  final boolean includesOtherImes=mSettingsValues.mIncludesOtherImesInLanguageSwitchList;
  final IBinder token=getWindow().getWindow().getAttributes().token;
  if (mShouldSwitchToLastSubtype) {
    final InputMethodSubtypeCompatWrapper lastSubtype=mImm.getLastInputMethodSubtype();
    final boolean lastSubtypeBelongsToThisIme=SubtypeUtils.checkIfSubtypeBelongsToThisIme(this,lastSubtype);
    if ((includesOtherImes || lastSubtypeBelongsToThisIme) && mImm.switchToLastInputMethod(token)) {
      mShouldSwitchToLastSubtype=false;
    }
 else {
      mImm.switchToNextInputMethod(token,!includesOtherImes);
      mShouldSwitchToLastSubtype=true;
    }
  }
 else {
    mImm.switchToNextInputMethod(token,!includesOtherImes);
  }
}