nus-yam/ex-repair huggingface dataset:
Program: 88152
Project: 88152
Buggy source:
private boolean hasAutoCorrectionForTypedWord(Map<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<CharSequence> suggestions,CharSequence typedWord,int correctionMode){
  if (TextUtils.isEmpty(typedWord))   return false;
  boolean isValidWord=isValidWordForAutoCorrection(dictionaries,typedWord,false);
  return wordComposer.size() > 1 && suggestions.size() > 0 && isValidWord && (correctionMode == Suggest.CORRECTION_FULL || correctionMode == Suggest.CORRECTION_FULL_BIGRAM);
}

Fixed version (ground truth):
private boolean hasAutoCorrectionForTypedWord(Map<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<CharSequence> suggestions,CharSequence typedWord,int correctionMode){
  if (TextUtils.isEmpty(typedWord))   return false;
  boolean allowsAutoCorrect=allowsToBeAutoCorrected(dictionaries,typedWord,false);
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsAutoCorrect && (correctionMode == Suggest.CORRECTION_FULL || correctionMode == Suggest.CORRECTION_FULL_BIGRAM);
}
Program: 88154
Project: 88154
Buggy source:
public boolean isValidWord(CharSequence typed){
  return AutoCorrection.isValidWordForAutoCorrection(mSuggest.getUnigramDictionaries(),typed,false);
}

Fixed version (ground truth):
public boolean isValidWord(CharSequence typed){
  return AutoCorrection.isValidWord(mSuggest.getUnigramDictionaries(),typed,false);
}
Program: 88162
Project: 88162
Buggy source:
@Override public void characters(char[] ch,int start,int length){
  if (WORD == mState) {
    final String word=String.copyValueOf(ch,start,length);
    mDictionary.add(word,mFreq,mBigramsMap.get(word));
  }
}

Fixed version (ground truth):
@Override public void characters(char[] ch,int start,int length){
  if (WORD == mState) {
    mWord+=String.copyValueOf(ch,start,length);
  }
}
Program: 88163
Project: 88163
Buggy source:
@Override public void endElement(String uri,String localName,String qName){
  if (WORD == mState)   mState=START;
}

Fixed version (ground truth):
@Override public void endElement(String uri,String localName,String qName){
  if (WORD == mState) {
    mDictionary.add(mWord,mFreq,mBigramsMap.get(mWord));
    mState=START;
  }
}
Program: 88164
Project: 88164
Buggy source:
/** 
 * Create the handler.
 * @param dict the dictionary to construct.
 * @param bigrams the bigrams as a map. This may be empty, but may not be null.
 */
public UnigramHandler(FusionDictionary dict,HashMap<String,ArrayList<WeightedString>> bigrams){
  mDictionary=dict;
  mBigramsMap=bigrams;
  mState=START;
  mFreq=0;
}

Fixed version (ground truth):
/** 
 * Create the handler.
 * @param dict the dictionary to construct.
 * @param bigrams the bigrams as a map. This may be empty, but may not be null.
 */
public UnigramHandler(FusionDictionary dict,HashMap<String,ArrayList<WeightedString>> bigrams){
  mDictionary=dict;
  mBigramsMap=bigrams;
  mWord="String_Node_Str";
  mState=START;
  mFreq=0;
}
Program: 88165
Project: 88165
Buggy source:
@Override public void characters(char[] ch,int start,int length){
  if (WORD == mState) {
    final String word=String.copyValueOf(ch,start,length);
    mDictionary.add(word,mFreq,mBigramsMap.get(word));
  }
}

Fixed version (ground truth):
@Override public void characters(char[] ch,int start,int length){
  if (WORD == mState) {
    mWord+=String.copyValueOf(ch,start,length);
  }
}
Program: 88166
Project: 88166
Buggy source:
@Override public void endElement(String uri,String localName,String qName){
  if (WORD == mState)   mState=START;
}

Fixed version (ground truth):
@Override public void endElement(String uri,String localName,String qName){
  if (WORD == mState) {
    mDictionary.add(mWord,mFreq,mBigramsMap.get(mWord));
    mState=START;
  }
}
Program: 88167
Project: 88167
Buggy source:
/** 
 * Create the handler.
 * @param dict the dictionary to construct.
 * @param bigrams the bigrams as a map. This may be empty, but may not be null.
 */
public UnigramHandler(FusionDictionary dict,HashMap<String,ArrayList<WeightedString>> bigrams){
  mDictionary=dict;
  mBigramsMap=bigrams;
  mState=START;
  mFreq=0;
}

Fixed version (ground truth):
/** 
 * Create the handler.
 * @param dict the dictionary to construct.
 * @param bigrams the bigrams as a map. This may be empty, but may not be null.
 */
public UnigramHandler(FusionDictionary dict,HashMap<String,ArrayList<WeightedString>> bigrams){
  mDictionary=dict;
  mBigramsMap=bigrams;
  mWord="String_Node_Str";
  mState=START;
  mFreq=0;
}
Program: 88168
Project: 88168
Buggy source:
@Override public void characters(char[] ch,int start,int length){
  if (WORD == mState) {
    final String word=String.copyValueOf(ch,start,length);
    mDictionary.add(word,mFreq,mBigramsMap.get(word));
  }
}

Fixed version (ground truth):
@Override public void characters(char[] ch,int start,int length){
  if (WORD == mState) {
    mWord+=String.copyValueOf(ch,start,length);
  }
}
Program: 88169
Project: 88169
Buggy source:
@Override public void endElement(String uri,String localName,String qName){
  if (WORD == mState)   mState=START;
}

Fixed version (ground truth):
@Override public void endElement(String uri,String localName,String qName){
  if (WORD == mState) {
    mDictionary.add(mWord,mFreq,mBigramsMap.get(mWord));
    mState=START;
  }
}
Program: 88170
Project: 88170
Buggy source:
/** 
 * Create the handler.
 * @param dict the dictionary to construct.
 * @param bigrams the bigrams as a map. This may be empty, but may not be null.
 */
public UnigramHandler(FusionDictionary dict,HashMap<String,ArrayList<WeightedString>> bigrams){
  mDictionary=dict;
  mBigramsMap=bigrams;
  mState=START;
  mFreq=0;
}

Fixed version (ground truth):
/** 
 * Create the handler.
 * @param dict the dictionary to construct.
 * @param bigrams the bigrams as a map. This may be empty, but may not be null.
 */
public UnigramHandler(FusionDictionary dict,HashMap<String,ArrayList<WeightedString>> bigrams){
  mDictionary=dict;
  mBigramsMap=bigrams;
  mWord="String_Node_Str";
  mState=START;
  mFreq=0;
}
Program: 88174
Project: 88174
Buggy source:
public UserDictionary(Context context,String locale){
  super(context,Suggest.DIC_USER);
  mLocale=locale;
  ContentResolver cres=context.getContentResolver();
  mObserver=new ContentObserver(null){
    @Override public void onChange(    boolean self){
      setRequiresReload(true);
    }
  }
;
  cres.registerContentObserver(Words.CONTENT_URI,true,mObserver);
  loadDictionary();
}

Fixed version (ground truth):
public UserDictionary(Context context,String locale){
  super(context,Suggest.DIC_USER);
  if (null == locale)   throw new NullPointerException();
  mLocale=locale;
  ContentResolver cres=context.getContentResolver();
  mObserver=new ContentObserver(null){
    @Override public void onChange(    boolean self){
      setRequiresReload(true);
    }
  }
;
  cres.registerContentObserver(Words.CONTENT_URI,true,mObserver);
  loadDictionary();
}
Program: 88175
Project: 88175
Buggy source:
@Override public void loadDictionaryAsync(){
  Cursor cursor=getContext().getContentResolver().query(Words.CONTENT_URI,PROJECTION_QUERY,"String_Node_Str",new String[]{mLocale},null);
  addWords(cursor);
}

Fixed version (ground truth):
@Override public void loadDictionaryAsync(){
  final String[] localeElements=TextUtils.isEmpty(mLocale) ? new String[]{} : mLocale.split("String_Node_Str",3);
  final StringBuilder request=new StringBuilder("String_Node_Str");
  String localeSoFar="String_Node_Str";
  for (int i=0; i < localeElements.length; ++i) {
    localeElements[i]=localeSoFar + localeElements[i];
    localeSoFar=localeElements[i] + "String_Node_Str";
    request.append("String_Node_Str");
  }
  Cursor cursor=getContext().getContentResolver().query(Words.CONTENT_URI,PROJECTION_QUERY,request.toString(),localeElements,null);
  addWords(cursor);
}
Program: 88176
Project: 88176
Buggy source:
public UserDictionary(Context context,String locale){
  super(context,Suggest.DIC_USER);
  mLocale=locale;
  ContentResolver cres=context.getContentResolver();
  mObserver=new ContentObserver(null){
    @Override public void onChange(    boolean self){
      setRequiresReload(true);
    }
  }
;
  cres.registerContentObserver(Words.CONTENT_URI,true,mObserver);
  loadDictionary();
}

Fixed version (ground truth):
public UserDictionary(Context context,String locale){
  super(context,Suggest.DIC_USER);
  if (null == locale)   throw new NullPointerException();
  mLocale=locale;
  ContentResolver cres=context.getContentResolver();
  mObserver=new ContentObserver(null){
    @Override public void onChange(    boolean self){
      setRequiresReload(true);
    }
  }
;
  cres.registerContentObserver(Words.CONTENT_URI,true,mObserver);
  loadDictionary();
}
Program: 88177
Project: 88177
Buggy source:
@Override public void loadDictionaryAsync(){
  Cursor cursor=getContext().getContentResolver().query(Words.CONTENT_URI,PROJECTION_QUERY,"String_Node_Str",new String[]{mLocale},null);
  addWords(cursor);
}

Fixed version (ground truth):
@Override public void loadDictionaryAsync(){
  final String[] localeElements=TextUtils.isEmpty(mLocale) ? new String[]{} : mLocale.split("String_Node_Str",3);
  final StringBuilder request=new StringBuilder("String_Node_Str");
  String localeSoFar="String_Node_Str";
  for (int i=0; i < localeElements.length; ++i) {
    localeElements[i]=localeSoFar + localeElements[i];
    localeSoFar=localeElements[i] + "String_Node_Str";
    request.append("String_Node_Str");
  }
  Cursor cursor=getContext().getContentResolver().query(Words.CONTENT_URI,PROJECTION_QUERY,request.toString(),localeElements,null);
  addWords(cursor);
}
Program: 88179
Project: 88179
Buggy source:
public Result getResults(final CharSequence originalText,final double threshold){
  final String[] gatheredSuggestions;
  final boolean looksLikeTypo;
  if (0 == mLength) {
    if (null == mBestSuggestion) {
      gatheredSuggestions=null;
      looksLikeTypo=false;
    }
 else {
      gatheredSuggestions=EMPTY_STRING_ARRAY;
      final double normalizedScore=Utils.calcNormalizedScore(originalText,mBestSuggestion,mBestScore);
      looksLikeTypo=(normalizedScore > threshold);
    }
  }
 else {
    if (DBG) {
      if (mLength != mSuggestions.size()) {
        Log.e(TAG,"String_Node_Str");
      }
    }
    Collections.reverse(mSuggestions);
    Utils.removeDupes(mSuggestions);
    gatheredSuggestions=mSuggestions.toArray(EMPTY_STRING_ARRAY);
    final int bestScore=mScores[0];
    final CharSequence bestSuggestion=mSuggestions.get(0);
    final double normalizedScore=Utils.calcNormalizedScore(originalText,bestSuggestion,bestScore);
    looksLikeTypo=(normalizedScore > threshold);
  }
  return new Result(gatheredSuggestions,looksLikeTypo);
}

Fixed version (ground truth):
public Result getResults(final CharSequence originalText,final double threshold){
  final String[] gatheredSuggestions;
  final boolean looksLikeTypo;
  if (0 == mLength) {
    if (null == mBestSuggestion) {
      gatheredSuggestions=null;
      looksLikeTypo=false;
    }
 else {
      gatheredSuggestions=EMPTY_STRING_ARRAY;
      final double normalizedScore=Utils.calcNormalizedScore(originalText,mBestSuggestion,mBestScore);
      looksLikeTypo=(normalizedScore > threshold);
    }
  }
 else {
    if (DBG) {
      if (mLength != mSuggestions.size()) {
        Log.e(TAG,"String_Node_Str");
      }
      for (int i=mLength - 1; i >= 0; --i) {
        Log.i(TAG,"String_Node_Str" + mScores[i] + "String_Node_Str"+ mSuggestions.get(i));
      }
    }
    Collections.reverse(mSuggestions);
    Utils.removeDupes(mSuggestions);
    gatheredSuggestions=mSuggestions.toArray(EMPTY_STRING_ARRAY);
    final int bestScore=mScores[mLength - 1];
    final CharSequence bestSuggestion=mSuggestions.get(0);
    final double normalizedScore=Utils.calcNormalizedScore(originalText,bestSuggestion,bestScore);
    looksLikeTypo=(normalizedScore > threshold);
    if (DBG) {
      Log.i(TAG,"String_Node_Str" + bestSuggestion + "String_Node_Str"+ bestScore);
      Log.i(TAG,"String_Node_Str" + normalizedScore + "String_Node_Str"+ threshold+ "String_Node_Str"+ looksLikeTypo);
    }
  }
  return new Result(gatheredSuggestions,looksLikeTypo);
}
Program: 88182
Project: 88182
Buggy source:
/** 
 * Used only for testing purposes This function will wait for loading from database to be done
 */
void waitForDictionaryLoading(){
  while (mUpdatingDictionary) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Used for testing purposes and in the spell checker This function will wait for loading from database to be done
 */
void waitForDictionaryLoading(){
  while (mUpdatingDictionary) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 88183
Project: 88183
Buggy source:
@Override public synchronized boolean isValidWord(CharSequence word){
synchronized (mUpdatingLock) {
    if (mRequiresReload)     startDictionaryLoadingTaskLocked();
    if (mUpdatingDictionary)     return false;
  }
  final int freq=getWordFrequency(word);
  return freq > -1;
}

Fixed version (ground truth):
@Override public synchronized boolean isValidWord(CharSequence word){
synchronized (mUpdatingLock) {
    if (mRequiresReload)     startDictionaryLoadingTaskLocked();
    if (mUpdatingDictionary)     return false;
  }
  return getWordFrequency(word) > -1;
}
Program: 88184
Project: 88184
Buggy source:
@Override public void getWords(final WordComposer codes,final WordCallback callback,final ProximityInfo proximityInfo){
synchronized (mUpdatingLock) {
    if (mRequiresReload)     startDictionaryLoadingTaskLocked();
    if (mUpdatingDictionary)     return;
  }
  mInputLength=codes.size();
  if (mCodes.length < mInputLength)   mCodes=new int[mInputLength][];
  for (int i=0; i < mInputLength; i++) {
    mCodes[i]=codes.getCodesAt(i);
  }
  mMaxDepth=mInputLength * 3;
  getWordsRec(mRoots,codes,mWordBuilder,0,false,1,0,-1,callback);
  for (int i=0; i < mInputLength; i++) {
    getWordsRec(mRoots,codes,mWordBuilder,0,false,1,0,i,callback);
  }
}

Fixed version (ground truth):
@Override public void getWords(final WordComposer codes,final WordCallback callback,final ProximityInfo proximityInfo){
synchronized (mUpdatingLock) {
    if (mRequiresReload)     startDictionaryLoadingTaskLocked();
    if (mUpdatingDictionary)     return;
  }
  getWordsInner(codes,callback,proximityInfo);
}
Program: 88185
Project: 88185
Buggy source:
public DictAndProximity createDictAndProximity(final Locale locale){
  final ProximityInfo proximityInfo=ProximityInfo.createSpellCheckerProximityInfo();
  final Resources resources=getResources();
  final int fallbackResourceId=Utils.getMainDictionaryResourceId(resources);
  final DictionaryCollection dictionaryCollection=DictionaryFactory.createDictionaryFromManager(this,locale,fallbackResourceId);
  final String localeStr=locale.toString();
  Dictionary userDict=mUserDictionaries.get(localeStr);
  if (null == userDict) {
    userDict=new UserDictionary(this,localeStr);
    mUserDictionaries.put(localeStr,userDict);
  }
  dictionaryCollection.addDictionary(userDict);
  return new DictAndProximity(dictionaryCollection,proximityInfo);
}

Fixed version (ground truth):
public DictAndProximity createDictAndProximity(final Locale locale){
  final ProximityInfo proximityInfo=ProximityInfo.createSpellCheckerProximityInfo();
  final Resources resources=getResources();
  final int fallbackResourceId=Utils.getMainDictionaryResourceId(resources);
  final DictionaryCollection dictionaryCollection=DictionaryFactory.createDictionaryFromManager(this,locale,fallbackResourceId);
  final String localeStr=locale.toString();
  Dictionary userDict=mUserDictionaries.get(localeStr);
  if (null == userDict) {
    userDict=new SynchronouslyLoadedUserDictionary(this,localeStr);
    mUserDictionaries.put(localeStr,userDict);
  }
  dictionaryCollection.addDictionary(userDict);
  return new DictAndProximity(dictionaryCollection,proximityInfo);
}
Program: 88186
Project: 88186
Buggy source:
/** 
 * Used only for testing purposes This function will wait for loading from database to be done
 */
void waitForDictionaryLoading(){
  while (mUpdatingDictionary) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Used for testing purposes and in the spell checker This function will wait for loading from database to be done
 */
void waitForDictionaryLoading(){
  while (mUpdatingDictionary) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 88187
Project: 88187
Buggy source:
@Override public synchronized boolean isValidWord(CharSequence word){
synchronized (mUpdatingLock) {
    if (mRequiresReload)     startDictionaryLoadingTaskLocked();
    if (mUpdatingDictionary)     return false;
  }
  final int freq=getWordFrequency(word);
  return freq > -1;
}

Fixed version (ground truth):
@Override public synchronized boolean isValidWord(CharSequence word){
synchronized (mUpdatingLock) {
    if (mRequiresReload)     startDictionaryLoadingTaskLocked();
    if (mUpdatingDictionary)     return false;
  }
  return getWordFrequency(word) > -1;
}
Program: 88188
Project: 88188
Buggy source:
@Override public void getWords(final WordComposer codes,final WordCallback callback,final ProximityInfo proximityInfo){
synchronized (mUpdatingLock) {
    if (mRequiresReload)     startDictionaryLoadingTaskLocked();
    if (mUpdatingDictionary)     return;
  }
  mInputLength=codes.size();
  if (mCodes.length < mInputLength)   mCodes=new int[mInputLength][];
  for (int i=0; i < mInputLength; i++) {
    mCodes[i]=codes.getCodesAt(i);
  }
  mMaxDepth=mInputLength * 3;
  getWordsRec(mRoots,codes,mWordBuilder,0,false,1,0,-1,callback);
  for (int i=0; i < mInputLength; i++) {
    getWordsRec(mRoots,codes,mWordBuilder,0,false,1,0,i,callback);
  }
}

Fixed version (ground truth):
@Override public void getWords(final WordComposer codes,final WordCallback callback,final ProximityInfo proximityInfo){
synchronized (mUpdatingLock) {
    if (mRequiresReload)     startDictionaryLoadingTaskLocked();
    if (mUpdatingDictionary)     return;
  }
  getWordsInner(codes,callback,proximityInfo);
}
Program: 88189
Project: 88189
Buggy source:
public DictAndProximity createDictAndProximity(final Locale locale){
  final ProximityInfo proximityInfo=ProximityInfo.createSpellCheckerProximityInfo();
  final Resources resources=getResources();
  final int fallbackResourceId=Utils.getMainDictionaryResourceId(resources);
  final DictionaryCollection dictionaryCollection=DictionaryFactory.createDictionaryFromManager(this,locale,fallbackResourceId);
  final String localeStr=locale.toString();
  Dictionary userDict=mUserDictionaries.get(localeStr);
  if (null == userDict) {
    userDict=new UserDictionary(this,localeStr);
    mUserDictionaries.put(localeStr,userDict);
  }
  dictionaryCollection.addDictionary(userDict);
  return new DictAndProximity(dictionaryCollection,proximityInfo);
}

Fixed version (ground truth):
public DictAndProximity createDictAndProximity(final Locale locale){
  final ProximityInfo proximityInfo=ProximityInfo.createSpellCheckerProximityInfo();
  final Resources resources=getResources();
  final int fallbackResourceId=Utils.getMainDictionaryResourceId(resources);
  final DictionaryCollection dictionaryCollection=DictionaryFactory.createDictionaryFromManager(this,locale,fallbackResourceId);
  final String localeStr=locale.toString();
  Dictionary userDict=mUserDictionaries.get(localeStr);
  if (null == userDict) {
    userDict=new SynchronouslyLoadedUserDictionary(this,localeStr);
    mUserDictionaries.put(localeStr,userDict);
  }
  dictionaryCollection.addDictionary(userDict);
  return new DictAndProximity(dictionaryCollection,proximityInfo);
}
Program: 88190
Project: 88190
Buggy source:
public static void recycle(final StringBuilder garbage){
  sInstance.mPool.add(garbage);
}

Fixed version (ground truth):
public static void recycle(final StringBuilder garbage){
  if (DEBUG) {
    final int gid=garbage.hashCode();
    for (    final StringBuilder q : sInstance.mPool) {
      if (gid == q.hashCode())       throw new RuntimeException("String_Node_Str" + gid);
    }
  }
  sInstance.mPool.add(garbage);
}
Program: 88191
Project: 88191
Buggy source:
protected void addBigramToSuggestions(CharSequence bigram){
  mSuggestions.add(bigram);
}

Fixed version (ground truth):
protected void addBigramToSuggestions(CharSequence bigram){
  final StringBuilder sb=StringBuilderPool.getStringBuilder(getApproxMaxWordLength());
  sb.append(bigram);
  mSuggestions.add(sb);
}
Program: 88192
Project: 88192
Buggy source:
public static void recycle(final StringBuilder garbage){
  sInstance.mPool.add(garbage);
}

Fixed version (ground truth):
public static void recycle(final StringBuilder garbage){
  if (DEBUG) {
    final int gid=garbage.hashCode();
    for (    final StringBuilder q : sInstance.mPool) {
      if (gid == q.hashCode())       throw new RuntimeException("String_Node_Str" + gid);
    }
  }
  sInstance.mPool.add(garbage);
}
Program: 88193
Project: 88193
Buggy source:
protected void addBigramToSuggestions(CharSequence bigram){
  mSuggestions.add(bigram);
}

Fixed version (ground truth):
protected void addBigramToSuggestions(CharSequence bigram){
  final StringBuilder sb=StringBuilderPool.getStringBuilder(getApproxMaxWordLength());
  sb.append(bigram);
  mSuggestions.add(sb);
}
Program: 88194
Project: 88194
Buggy source:
/** 
 * Initializes a dictionary from a dictionary pack. This searches for a content provider providing a dictionary pack for the specified locale. If none is found, it falls back to using the resource passed as fallBackResId as a dictionary.
 * @param context application context for reading resources
 * @param locale the locale for which to create the dictionary
 * @param fallbackResId the id of the resource to use as a fallback if no pack is found
 * @return an initialized instance of DictionaryCollection
 */
public static DictionaryCollection createDictionaryFromManager(Context context,Locale locale,int fallbackResId){
  if (null == locale) {
    Log.e(TAG,"String_Node_Str");
    return new DictionaryCollection(createBinaryDictionary(context,fallbackResId,locale));
  }
  final List<Dictionary> dictList=new LinkedList<Dictionary>();
  final List<AssetFileAddress> assetFileList=BinaryDictionaryGetter.getDictionaryFiles(locale,context,fallbackResId);
  if (null != assetFileList) {
    for (    final AssetFileAddress f : assetFileList) {
      final BinaryDictionary binaryDictionary=new BinaryDictionary(context,f.mFilename,f.mOffset,f.mLength,null);
      if (binaryDictionary.isValidDictionary()) {
        dictList.add(binaryDictionary);
      }
    }
  }
  if (null == dictList) {
    return new DictionaryCollection();
  }
 else {
    if (dictList.isEmpty()) {
      return new DictionaryCollection(createBinaryDictionary(context,fallbackResId,locale));
    }
 else {
      return new DictionaryCollection(dictList);
    }
  }
}

Fixed version (ground truth):
/** 
 * Initializes a dictionary from a dictionary pack. This searches for a content provider providing a dictionary pack for the specified locale. If none is found, it falls back to using the resource passed as fallBackResId as a dictionary.
 * @param context application context for reading resources
 * @param locale the locale for which to create the dictionary
 * @param fallbackResId the id of the resource to use as a fallback if no pack is found
 * @return an initialized instance of DictionaryCollection
 */
public static DictionaryCollection createDictionaryFromManager(Context context,Locale locale,int fallbackResId){
  if (null == locale) {
    Log.e(TAG,"String_Node_Str");
    return new DictionaryCollection(createBinaryDictionary(context,fallbackResId,locale));
  }
  final List<Dictionary> dictList=new LinkedList<Dictionary>();
  final List<AssetFileAddress> assetFileList=BinaryDictionaryGetter.getDictionaryFiles(locale,context,fallbackResId);
  if (null != assetFileList) {
    for (    final AssetFileAddress f : assetFileList) {
      final BinaryDictionary binaryDictionary=new BinaryDictionary(context,f.mFilename,f.mOffset,f.mLength,null);
      if (binaryDictionary.isValidDictionary()) {
        dictList.add(binaryDictionary);
      }
    }
  }
  return new DictionaryCollection(dictList);
}
Program: 88195
Project: 88195
Buggy source:
/** 
 * Initializes a dictionary from a dictionary pack. This searches for a content provider providing a dictionary pack for the specified locale. If none is found, it falls back to using the resource passed as fallBackResId as a dictionary.
 * @param context application context for reading resources
 * @param locale the locale for which to create the dictionary
 * @param fallbackResId the id of the resource to use as a fallback if no pack is found
 * @return an initialized instance of DictionaryCollection
 */
public static DictionaryCollection createDictionaryFromManager(Context context,Locale locale,int fallbackResId){
  if (null == locale) {
    Log.e(TAG,"String_Node_Str");
    return new DictionaryCollection(createBinaryDictionary(context,fallbackResId,locale));
  }
  final List<Dictionary> dictList=new LinkedList<Dictionary>();
  final List<AssetFileAddress> assetFileList=BinaryDictionaryGetter.getDictionaryFiles(locale,context,fallbackResId);
  if (null != assetFileList) {
    for (    final AssetFileAddress f : assetFileList) {
      final BinaryDictionary binaryDictionary=new BinaryDictionary(context,f.mFilename,f.mOffset,f.mLength,null);
      if (binaryDictionary.isValidDictionary()) {
        dictList.add(binaryDictionary);
      }
    }
  }
  if (null == dictList) {
    return new DictionaryCollection();
  }
 else {
    if (dictList.isEmpty()) {
      return new DictionaryCollection(createBinaryDictionary(context,fallbackResId,locale));
    }
 else {
      return new DictionaryCollection(dictList);
    }
  }
}

Fixed version (ground truth):
/** 
 * Initializes a dictionary from a dictionary pack. This searches for a content provider providing a dictionary pack for the specified locale. If none is found, it falls back to using the resource passed as fallBackResId as a dictionary.
 * @param context application context for reading resources
 * @param locale the locale for which to create the dictionary
 * @param fallbackResId the id of the resource to use as a fallback if no pack is found
 * @return an initialized instance of DictionaryCollection
 */
public static DictionaryCollection createDictionaryFromManager(Context context,Locale locale,int fallbackResId){
  if (null == locale) {
    Log.e(TAG,"String_Node_Str");
    return new DictionaryCollection(createBinaryDictionary(context,fallbackResId,locale));
  }
  final List<Dictionary> dictList=new LinkedList<Dictionary>();
  final List<AssetFileAddress> assetFileList=BinaryDictionaryGetter.getDictionaryFiles(locale,context,fallbackResId);
  if (null != assetFileList) {
    for (    final AssetFileAddress f : assetFileList) {
      final BinaryDictionary binaryDictionary=new BinaryDictionary(context,f.mFilename,f.mOffset,f.mLength,null);
      if (binaryDictionary.isValidDictionary()) {
        dictList.add(binaryDictionary);
      }
    }
  }
  return new DictionaryCollection(dictList);
}
Program: 88197
Project: 88197
Buggy source:
@Override public boolean onLongClick(View view){
  if (mStripParams.mMoreSuggestionsAvailable) {
    expandCandidatesPane();
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View view){
  if (mStripParams.mMoreSuggestionsAvailable) {
    toggleCandidatesPane();
    return true;
  }
  return false;
}
Program: 88199
Project: 88199
Buggy source:
@Override public boolean onLongClick(View view){
  if (mStripParams.mMoreSuggestionsAvailable) {
    expandCandidatesPane();
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View view){
  if (mStripParams.mMoreSuggestionsAvailable) {
    toggleCandidatesPane();
    return true;
  }
  return false;
}
Program: 88200
Project: 88200
Buggy source:
private Builder addWord(CharSequence word,SuggestedWordInfo suggestedWordInfo){
  mWords.add(word);
  mSuggestedWordInfoList.add(suggestedWordInfo);
  return this;
}

Fixed version (ground truth):
private Builder addWord(CharSequence word,SuggestedWordInfo suggestedWordInfo){
  if (!TextUtils.isEmpty(word)) {
    mWords.add(word);
    mSuggestedWordInfoList.add(suggestedWordInfo);
  }
  return this;
}
Program: 88201
Project: 88201
Buggy source:
public Builder setApplicationSpecifiedCompletions(CompletionInfo[] infos){
  for (  CompletionInfo info : infos)   addWord(info.getText());
  return this;
}

Fixed version (ground truth):
public Builder setApplicationSpecifiedCompletions(CompletionInfo[] infos){
  for (  CompletionInfo info : infos) {
    if (null != info)     addWord(info.getText());
  }
  return this;
}
Program: 88202
Project: 88202
Buggy source:
/** 
 * Returns a list of file addresses for a given locale, trying relevant methods in order. Tries to get binary dictionaries from various sources, in order: - Uses a private method of getting a private dictionaries, as implemented by the PrivateBinaryDictionaryGetter class. If that fails: - Uses a content provider to get a public dictionary set, as per the protocol described in BinaryDictionaryFileDumper. If that fails: - Gets a file name from the fallback resource passed as an argument. If that fails: - Returns null.
 * @return The address of a valid file, or null.
 */
public static List<AssetFileAddress> getDictionaryFiles(Locale locale,Context context,int fallbackResId){
  final List<AssetFileAddress> privateFiles=PrivateBinaryDictionaryGetter.getDictionaryFiles(locale,context);
  if (null != privateFiles) {
    return privateFiles;
  }
 else {
    try {
      return BinaryDictionaryFileDumper.getDictSetFromContentProvider(locale,context);
    }
 catch (    FileNotFoundException e) {
      Log.e(TAG,"String_Node_Str" + locale.toString() + "String_Node_Str");
      return Arrays.asList(loadFallbackResource(context,fallbackResId));
    }
catch (    IOException e) {
      Log.e(TAG,"String_Node_Str" + locale.toString() + "String_Node_Str");
      return Arrays.asList(loadFallbackResource(context,fallbackResId));
    }
  }
}

Fixed version (ground truth):
/** 
 * Returns a list of file addresses for a given locale, trying relevant methods in order. Tries to get binary dictionaries from various sources, in order: - Uses a private method of getting a private dictionaries, as implemented by the PrivateBinaryDictionaryGetter class. If that fails: - Uses a content provider to get a public dictionary set, as per the protocol described in BinaryDictionaryFileDumper. If that fails: - Gets a file name from the fallback resource passed as an argument. If that fails: - Returns null.
 * @return The address of a valid file, or null.
 */
public static List<AssetFileAddress> getDictionaryFiles(Locale locale,Context context,int fallbackResId){
  final List<AssetFileAddress> privateFiles=PrivateBinaryDictionaryGetter.getDictionaryFiles(locale,context);
  if (null != privateFiles) {
    return privateFiles;
  }
 else {
    try {
      List<AssetFileAddress> listFromContentProvider=BinaryDictionaryFileDumper.getDictSetFromContentProvider(locale,context);
      if (null != listFromContentProvider) {
        return listFromContentProvider;
      }
    }
 catch (    FileNotFoundException e) {
      Log.e(TAG,"String_Node_Str" + locale.toString() + "String_Node_Str");
    }
catch (    IOException e) {
      Log.e(TAG,"String_Node_Str" + locale.toString() + "String_Node_Str");
    }
    return Arrays.asList(loadFallbackResource(context,fallbackResId));
  }
}
Program: 88210
Project: 88210
Buggy source:
/** 
 * Finds all possible nearby key indices around a touch event point and returns the nearest key index. The algorithm to determine the nearby keys depends on the threshold set by  {@link #setProximityThreshold(int)} and the mode set by{@link #setProximityCorrectionEnabled(boolean)}.
 * @param x The x-coordinate of a touch point
 * @param y The y-coordinate of a touch point
 * @param allCodes All nearby key code except functional key are returned in this array
 * @return The nearest key index
 */
public int getKeyIndexAndNearbyCodes(int x,int y,final int[] allCodes){
  final List<Key> keys=getKeys();
  final int touchX=getTouchX(x);
  final int touchY=getTouchY(y);
  initializeNearbyKeys();
  int primaryIndex=NOT_A_KEY;
  for (  final int index : mKeyboard.getNearestKeys(touchX,touchY)) {
    final Key key=keys.get(index);
    final boolean isInside=mKeyboard.isInside(key,touchX,touchY);
    final int distance=key.squaredDistanceToEdge(touchX,touchY);
    if (isInside || (mProximityCorrectOn && distance < mProximityThresholdSquare)) {
      final int insertedPosition=sortNearbyKeys(index,distance);
      if (insertedPosition == 0 && isInside)       primaryIndex=index;
    }
  }
  if (allCodes != null && allCodes.length > 0) {
    getNearbyKeyCodes(allCodes);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ (primaryIndex == NOT_A_KEY ? "String_Node_Str" : keys.get(primaryIndex).mCode)+ "String_Node_Str"+ Arrays.toString(allCodes));
    }
  }
  return primaryIndex;
}

Fixed version (ground truth):
/** 
 * Finds all possible nearby key indices around a touch event point and returns the nearest key index. The algorithm to determine the nearby keys depends on the threshold set by  {@link #setProximityThreshold(int)} and the mode set by{@link #setProximityCorrectionEnabled(boolean)}.
 * @param x The x-coordinate of a touch point
 * @param y The y-coordinate of a touch point
 * @param allCodes All nearby key code except functional key are returned in this array
 * @return The nearest key index
 */
public int getKeyIndexAndNearbyCodes(int x,int y,final int[] allCodes){
  final List<Key> keys=getKeys();
  final int touchX=getTouchX(x);
  final int touchY=getTouchY(y);
  initializeNearbyKeys();
  int primaryIndex=NOT_A_KEY;
  for (  final int index : mKeyboard.getNearestKeys(touchX,touchY)) {
    final Key key=keys.get(index);
    final boolean isInside=mKeyboard.isInside(key,touchX,touchY);
    final int distance=key.squaredDistanceToEdge(touchX,touchY);
    if (isInside || (mProximityCorrectOn && distance < mProximityThresholdSquare)) {
      final int insertedPosition=sortNearbyKeys(index,distance);
      if (insertedPosition == 0)       primaryIndex=index;
    }
  }
  if (allCodes != null && allCodes.length > 0) {
    getNearbyKeyCodes(allCodes);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ (primaryIndex == NOT_A_KEY ? "String_Node_Str" : keys.get(primaryIndex).mCode)+ "String_Node_Str"+ Arrays.toString(allCodes));
    }
  }
  return primaryIndex;
}
Program: 88211
Project: 88211
Buggy source:
public static Method getMethod(Class<?> targetClass,String name,Class<?>... parameterTypes){
  try {
    return targetClass.getMethod(name,parameterTypes);
  }
 catch (  SecurityException e) {
    return null;
  }
catch (  NoSuchMethodException e) {
    return null;
  }
}

Fixed version (ground truth):
public static Method getMethod(Class<?> targetClass,String name,Class<?>... parameterTypes){
  if (targetClass == null || TextUtils.isEmpty(name))   return null;
  try {
    return targetClass.getMethod(name,parameterTypes);
  }
 catch (  SecurityException e) {
    return null;
  }
catch (  NoSuchMethodException e) {
    return null;
  }
}
Program: 88212
Project: 88212
Buggy source:
public Map<InputMethodInfoCompatWrapper,List<InputMethodSubtypeCompatWrapper>> getShortcutInputMethodsAndSubtypes(){
  Object retval=CompatUtils.invoke(mImm,null,METHOD_getShortcutInputMethodsAndSubtypes);
  if (!(retval instanceof Map))   return null;
  Map<InputMethodInfoCompatWrapper,List<InputMethodSubtypeCompatWrapper>> shortcutMap=new HashMap<InputMethodInfoCompatWrapper,List<InputMethodSubtypeCompatWrapper>>();
  final Map<?,?> retvalMap=(Map<?,?>)retval;
  for (  Object key : retvalMap.keySet()) {
    if (!(key instanceof InputMethodInfo)) {
      Log.e(TAG,"String_Node_Str");
      return null;
    }
    shortcutMap.put(new InputMethodInfoCompatWrapper((InputMethodInfo)key),CompatUtils.copyInputMethodSubtypeListToWrapper(retvalMap.get(key)));
  }
  return shortcutMap;
}

Fixed version (ground truth):
public Map<InputMethodInfoCompatWrapper,List<InputMethodSubtypeCompatWrapper>> getShortcutInputMethodsAndSubtypes(){
  Object retval=CompatUtils.invoke(mImm,null,METHOD_getShortcutInputMethodsAndSubtypes);
  if (!(retval instanceof Map))   return Collections.emptyMap();
  Map<InputMethodInfoCompatWrapper,List<InputMethodSubtypeCompatWrapper>> shortcutMap=new HashMap<InputMethodInfoCompatWrapper,List<InputMethodSubtypeCompatWrapper>>();
  final Map<?,?> retvalMap=(Map<?,?>)retval;
  for (  Object key : retvalMap.keySet()) {
    if (!(key instanceof InputMethodInfo)) {
      Log.e(TAG,"String_Node_Str");
      return null;
    }
    shortcutMap.put(new InputMethodInfoCompatWrapper((InputMethodInfo)key),CompatUtils.copyInputMethodSubtypeListToWrapper(retvalMap.get(key)));
  }
  return shortcutMap;
}
Program: 88213
Project: 88213
Buggy source:
public boolean switchToLastInputMethod(IBinder token){
  if (mImm == null)   return false;
  return mImm.switchToLastInputMethod(token);
}

Fixed version (ground truth):
public boolean switchToLastInputMethod(IBinder token){
  return (Boolean)CompatUtils.invoke(mImm,false,METHOD_switchToLastInputMethod,token);
}
Program: 88214
Project: 88214
Buggy source:
public InputMethodSubtypeCompatWrapper(Object subtype){
  super(CLASS_InputMethodSubtype.isInstance(subtype) ? subtype : null);
  if (DBG) {
    Log.d(TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
public InputMethodSubtypeCompatWrapper(Object subtype){
  super((CLASS_InputMethodSubtype != null && CLASS_InputMethodSubtype.isInstance(subtype)) ? subtype : null);
  if (DBG) {
    Log.d(TAG,"String_Node_Str");
  }
}
Program: 88215
Project: 88215
Buggy source:
public String getMode(){
  return (String)CompatUtils.invoke(mObj,null,METHOD_getMode);
}

Fixed version (ground truth):
public String getMode(){
  String s=(String)CompatUtils.invoke(mObj,null,METHOD_getMode);
  if (TextUtils.isEmpty(s))   return DEFAULT_MODE;
  return s;
}
Program: 88216
Project: 88216
Buggy source:
public boolean containsExtraValueKey(String key){
  return (Boolean)CompatUtils.invoke(mObj,null,METHOD_containsExtraValueKey,key);
}

Fixed version (ground truth):
public boolean containsExtraValueKey(String key){
  return (Boolean)CompatUtils.invoke(mObj,false,METHOD_containsExtraValueKey,key);
}
Program: 88217
Project: 88217
Buggy source:
public String getLocale(){
  return (String)CompatUtils.invoke(mObj,null,METHOD_getLocale);
}

Fixed version (ground truth):
public String getLocale(){
  final String s=(String)CompatUtils.invoke(mObj,null,METHOD_getLocale);
  if (TextUtils.isEmpty(s))   return DEFAULT_LOCALE;
  return s;
}
Program: 88218
Project: 88218
Buggy source:
private void setHasLoggingInfo(boolean hasLoggingInfo){
  mHasLoggingInfo=hasLoggingInfo;
  UserHappinessSignals.setHasVoiceLoggingInfo(hasLoggingInfo);
}

Fixed version (ground truth):
private void setHasLoggingInfo(boolean hasLoggingInfo){
  mHasLoggingInfo=hasLoggingInfo;
  VoiceInputLoggerCompatUtils.setHasVoiceLoggingInfoCompat(hasLoggingInfo);
}
Program: 88219
Project: 88219
Buggy source:
public void textModifiedByChooseSuggestion(int suggestionLength,int replacedPhraseLength,int index,String before,String after){
  setHasLoggingInfo(true);
  Intent i=newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED);
  i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH,suggestionLength);
  i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_REPLACED_LENGTH,replacedPhraseLength);
  i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE,LoggingEvents.VoiceIme.TEXT_MODIFIED_TYPE_CHOOSE_SUGGESTION);
  i.putExtra(LoggingEvents.VoiceIme.EXTRA_N_BEST_CHOOSE_INDEX,index);
  i.putExtra(LoggingEvents.VoiceIme.EXTRA_BEFORE_N_BEST_CHOOSE,before);
  i.putExtra(LoggingEvents.VoiceIme.EXTRA_AFTER_N_BEST_CHOOSE,after);
  mContext.sendBroadcast(i);
}

Fixed version (ground truth):
public void textModifiedByChooseSuggestion(int suggestionLength,int replacedPhraseLength,int index,String before,String after){
  setHasLoggingInfo(true);
  Intent i=newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED);
  i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH,suggestionLength);
  i.putExtra(VoiceInputLoggerCompatUtils.EXTRA_TEXT_REPLACED_LENGTH,replacedPhraseLength);
  i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE,LoggingEvents.VoiceIme.TEXT_MODIFIED_TYPE_CHOOSE_SUGGESTION);
  i.putExtra(LoggingEvents.VoiceIme.EXTRA_N_BEST_CHOOSE_INDEX,index);
  i.putExtra(VoiceInputLoggerCompatUtils.EXTRA_BEFORE_N_BEST_CHOOSE,before);
  i.putExtra(VoiceInputLoggerCompatUtils.EXTRA_AFTER_N_BEST_CHOOSE,after);
  mContext.sendBroadcast(i);
}
Program: 88221
Project: 88221
Buggy source:
public void setVoiceInput(VoiceInput voiceInput,SubtypeSwitcher switcher){
  if (mVoiceInput == null && voiceInput != null) {
    mVoiceInput=voiceInput;
    switcher.setVoiceInputConnector(this);
  }
}

Fixed version (ground truth):
public void setVoiceInput(VoiceInput voiceInput,SubtypeSwitcher switcher){
  if (mVoiceInput == null && voiceInput != null) {
    mVoiceInput=voiceInput;
  }
  switcher.setVoiceInputConnector(this);
}
Program: 88222
Project: 88222
Buggy source:
private void showOptionsMenuInternal(CharSequence title,CharSequence[] items,DialogInterface.OnClickListener listener){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.ic_dialog_keyboard);
  builder.setNegativeButton(android.R.string.cancel,null);
  builder.setItems(items,listener);
  builder.setTitle(title);
  mOptionsDialog=builder.create();
  mOptionsDialog.setCanceledOnTouchOutside(true);
  Window window=mOptionsDialog.getWindow();
  WindowManager.LayoutParams lp=window.getAttributes();
  lp.token=mKeyboardSwitcher.getInputView().getWindowToken();
  lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
  window.setAttributes(lp);
  window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
  mOptionsDialog.show();
}

Fixed version (ground truth):
private void showOptionsMenuInternal(CharSequence title,CharSequence[] items,DialogInterface.OnClickListener listener){
  final IBinder windowToken=mKeyboardSwitcher.getInputView().getWindowToken();
  if (windowToken == null)   return;
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.ic_dialog_keyboard);
  builder.setNegativeButton(android.R.string.cancel,null);
  builder.setItems(items,listener);
  builder.setTitle(title);
  mOptionsDialog=builder.create();
  mOptionsDialog.setCanceledOnTouchOutside(true);
  Window window=mOptionsDialog.getWindow();
  WindowManager.LayoutParams lp=window.getAttributes();
  lp.token=windowToken;
  lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
  window.setAttributes(lp);
  window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
  mOptionsDialog.show();
}
Program: 88223
Project: 88223
Buggy source:
private void showOptionsMenuInternal(CharSequence title,CharSequence[] items,DialogInterface.OnClickListener listener){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.ic_dialog_keyboard);
  builder.setNegativeButton(android.R.string.cancel,null);
  builder.setItems(items,listener);
  builder.setTitle(title);
  mOptionsDialog=builder.create();
  mOptionsDialog.setCanceledOnTouchOutside(true);
  Window window=mOptionsDialog.getWindow();
  WindowManager.LayoutParams lp=window.getAttributes();
  lp.token=mKeyboardSwitcher.getInputView().getWindowToken();
  lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
  window.setAttributes(lp);
  window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
  mOptionsDialog.show();
}

Fixed version (ground truth):
private void showOptionsMenuInternal(CharSequence title,CharSequence[] items,DialogInterface.OnClickListener listener){
  final IBinder windowToken=mKeyboardSwitcher.getInputView().getWindowToken();
  if (windowToken == null)   return;
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.ic_dialog_keyboard);
  builder.setNegativeButton(android.R.string.cancel,null);
  builder.setItems(items,listener);
  builder.setTitle(title);
  mOptionsDialog=builder.create();
  mOptionsDialog.setCanceledOnTouchOutside(true);
  Window window=mOptionsDialog.getWindow();
  WindowManager.LayoutParams lp=window.getAttributes();
  lp.token=windowToken;
  lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
  window.setAttributes(lp);
  window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
  mOptionsDialog.show();
}
Program: 88224
Project: 88224
Buggy source:
private void loadSettings(EditorInfo attribute){
  final SharedPreferences prefs=mPrefs;
  Vibrator vibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
  mVibrateOn=vibrator != null && vibrator.hasVibrator() && prefs.getBoolean(Settings.PREF_VIBRATE_ON,false);
  mSoundOn=prefs.getBoolean(Settings.PREF_SOUND_ON,false);
  mPopupOn=isPopupEnabled(prefs);
  mAutoCap=prefs.getBoolean(Settings.PREF_AUTO_CAP,true);
  mQuickFixes=isQuickFixesEnabled(prefs);
  mAutoCorrectEnabled=isAutoCorrectEnabled(prefs);
  mBigramSuggestionEnabled=mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs);
  loadAndSetAutoCorrectionThreshold(prefs);
  mVoiceConnector.loadSettings(attribute,prefs);
  updateCorrectionMode();
  updateAutoTextEnabled();
  updateSuggestionVisibility(prefs);
  SubtypeSwitcher.getInstance().loadSettings();
}

Fixed version (ground truth):
private void loadSettings(EditorInfo attribute){
  final SharedPreferences prefs=mPrefs;
  Vibrator vibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
  mVibrateOn=vibrator != null && vibrator.hasVibrator() && prefs.getBoolean(Settings.PREF_VIBRATE_ON,false);
  mSoundOn=prefs.getBoolean(Settings.PREF_SOUND_ON,true);
  mPopupOn=isPopupEnabled(prefs);
  mAutoCap=prefs.getBoolean(Settings.PREF_AUTO_CAP,true);
  mQuickFixes=isQuickFixesEnabled(prefs);
  mAutoCorrectEnabled=isAutoCorrectEnabled(prefs);
  mBigramSuggestionEnabled=mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs);
  loadAndSetAutoCorrectionThreshold(prefs);
  mVoiceConnector.loadSettings(attribute,prefs);
  updateCorrectionMode();
  updateAutoTextEnabled();
  updateSuggestionVisibility(prefs);
  SubtypeSwitcher.getInstance().loadSettings();
}
Program: 88225
Project: 88225
Buggy source:
private void loadSettings(EditorInfo attribute){
  final SharedPreferences prefs=mPrefs;
  Vibrator vibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
  mVibrateOn=vibrator != null && vibrator.hasVibrator() && prefs.getBoolean(Settings.PREF_VIBRATE_ON,false);
  mSoundOn=prefs.getBoolean(Settings.PREF_SOUND_ON,false);
  mPopupOn=isPopupEnabled(prefs);
  mAutoCap=prefs.getBoolean(Settings.PREF_AUTO_CAP,true);
  mQuickFixes=isQuickFixesEnabled(prefs);
  mAutoCorrectEnabled=isAutoCorrectEnabled(prefs);
  mBigramSuggestionEnabled=mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs);
  loadAndSetAutoCorrectionThreshold(prefs);
  mVoiceConnector.loadSettings(attribute,prefs);
  updateCorrectionMode();
  updateAutoTextEnabled();
  updateSuggestionVisibility(prefs);
  SubtypeSwitcher.getInstance().loadSettings();
}

Fixed version (ground truth):
private void loadSettings(EditorInfo attribute){
  final SharedPreferences prefs=mPrefs;
  Vibrator vibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
  mVibrateOn=vibrator != null && vibrator.hasVibrator() && prefs.getBoolean(Settings.PREF_VIBRATE_ON,false);
  mSoundOn=prefs.getBoolean(Settings.PREF_SOUND_ON,true);
  mPopupOn=isPopupEnabled(prefs);
  mAutoCap=prefs.getBoolean(Settings.PREF_AUTO_CAP,true);
  mQuickFixes=isQuickFixesEnabled(prefs);
  mAutoCorrectEnabled=isAutoCorrectEnabled(prefs);
  mBigramSuggestionEnabled=mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs);
  loadAndSetAutoCorrectionThreshold(prefs);
  mVoiceConnector.loadSettings(attribute,prefs);
  updateCorrectionMode();
  updateAutoTextEnabled();
  updateSuggestionVisibility(prefs);
  SubtypeSwitcher.getInstance().loadSettings();
}