nus-yam/ex-repair huggingface dataset:
Program: 157119
Project: 157119
Buggy source:
@ForgeSubscribe public void onSoundLoad(SoundLoadEvent event){
  for (  String soundFile : Sounds.soundFiles) {
    try {
      event.manager.addSound(soundFile,new File(this.getClass().getResource("String_Node_Str" + soundFile).toURI()));
    }
 catch (    Exception e) {
      LogHelper.log(Level.WARNING,"String_Node_Str" + soundFile);
    }
  }
}

Fixed version (ground truth):
@ForgeSubscribe public void onSoundLoad(SoundLoadEvent event){
  for (  String soundFile : Sounds.soundFiles) {
    try {
      event.manager.soundPoolSounds.addSound(soundFile,this.getClass().getResource("String_Node_Str" + soundFile));
    }
 catch (    Exception e) {
      LogHelper.log(Level.WARNING,"String_Node_Str" + soundFile);
    }
  }
}
Program: 157120
Project: 157120
Buggy source:
public static void addSmeltingRecipe(ItemStack input,ItemStack stone,ItemStack fuel){
  ItemStack result=FurnaceRecipes.smelting().getSmeltingResult(input);
  if (result == null)   return;
  Object[] list=new Object[9];
  list[0]=stone;
  list[1]=fuel;
  for (int i=2; i < 9; i++)   list[i]=new ItemStack(input.getItem(),1,input.getItemDamage());
  GameRegistry.addShapelessRecipe(new ItemStack(result.getItem(),7,result.getItemDamage()),list);
}

Fixed version (ground truth):
public static void addSmeltingRecipe(ItemStack input,ItemStack stone,ItemStack fuel){
  ItemStack result=FurnaceRecipes.smelting().getSmeltingResult(input);
  if (result == null)   return;
  Object[] list=new Object[9];
  list[0]=stone;
  list[1]=fuel;
  for (int i=2; i < 9; i++)   list[i]=new ItemStack(input.getItem(),1,input.getItemDamage());
  GameRegistry.addShapelessRecipe(new ItemStack(result.getItem(),(result.stackSize * 7),result.getItemDamage()),list);
}
Program: 157122
Project: 157122
Buggy source:
public void render(TileCalcinator calcinator,double x,double y,double z){
  GL11.glPushMatrix();
  GL11.glDisable(GL11.GL_LIGHTING);
  GL11.glTranslated(x,y,z);
  ForgeHooksClient.bindTexture(Reference.SPRITE_SHEET_LOCATION + "String_Node_Str",0);
  legFrontLeft.render(scale);
  legFrontRight.render(scale);
  legBackLeft.render(scale);
  legBackRight.render(scale);
  armFrontLeft.render(scale);
  armFrontRight.render(scale);
  armBackLeft.render(scale);
  armBackRight.render(scale);
  firePlate.render(scale);
  bowlBottom.render(scale);
  bowlBack.render(scale);
  bowlFront.render(scale);
  bowlLeft.render(scale);
  bowlRight.render(scale);
  ashLayer.render(scale);
  GL11.glEnable(GL11.GL_LIGHTING);
  GL11.glPopMatrix();
}

Fixed version (ground truth):
public void render(TileCalcinator calcinator,double x,double y,double z){
  GL11.glPushMatrix();
  GL11.glDisable(GL11.GL_LIGHTING);
  GL11.glTranslated(x,y,z);
  ForgeHooksClient.bindTexture(Reference.SPRITE_SHEET_LOCATION + "String_Node_Str",0);
  firePlate.render(scale);
  bowlBottom.render(scale);
  bowlBack.render(scale);
  bowlFront.render(scale);
  bowlLeft.render(scale);
  bowlRight.render(scale);
  ashLayer.render(scale);
  GL11.glEnable(GL11.GL_LIGHTING);
  GL11.glPopMatrix();
}
Program: 157124
Project: 157124
Buggy source:
public static void onExternalPackChanged(Intent eventIntent,AnySoftKeyboard ime,AddOnsFactory... factories){
  boolean cleared=false;
  boolean recreateView=false;
  for (  AddOnsFactory<?> factory : factories) {
    try {
      if (factory.isEventRequiresCacheRefresh(eventIntent)) {
        cleared=true;
        if (factory.isEventRequiresViewReset(eventIntent))         recreateView=true;
        Logger.d("String_Node_Str",factory.getClass().getName() + "String_Node_Str" + recreateView);
        factory.clearAddOnList();
      }
    }
 catch (    PackageManager.NameNotFoundException e) {
      e.printStackTrace();
    }
  }
  if (cleared)   ime.resetAddOnsCaches(recreateView);
}

Fixed version (ground truth):
public static void onExternalPackChanged(Intent eventIntent,AnySoftKeyboard ime,AddOnsFactory... factories){
  boolean cleared=false;
  boolean recreateView=false;
  for (  AddOnsFactory<?> factory : factories) {
    try {
      if (factory.isEventRequiresCacheRefresh(eventIntent)) {
        cleared=true;
        if (factory.isEventRequiresViewReset(eventIntent))         recreateView=true;
        Logger.d("String_Node_Str",factory.getClass().getName() + "String_Node_Str" + recreateView);
        factory.clearAddOnList();
      }
    }
 catch (    PackageManager.NameNotFoundException e) {
      Logger.w("String_Node_Str",e,"String_Node_Str",factory);
    }
  }
  if (cleared)   ime.resetAddOnsCaches(recreateView);
}
Program: 157125
Project: 157125
Buggy source:
@NonNull public List<DictionaryAddOnAndBuilder> getBuildersForKeyboard(AnyKeyboard keyboard){
  List<DictionaryAddOnAndBuilder> builders=new ArrayList<>();
  final String dictionaryValue=mSharedPreferences.getString(getDictionaryOverrideKey(keyboard),null);
  if (TextUtils.isEmpty(dictionaryValue)) {
    final DictionaryAddOnAndBuilder builderByLocale=AnyApplication.getExternalDictionaryFactory(mContext).getDictionaryBuilderByLocale(keyboard.getDefaultDictionaryLocale());
    if (builderByLocale != null)     builders.add(builderByLocale);
  }
 else {
    String[] ids=dictionaryValue.split("String_Node_Str");
    for (    String id : ids) {
      final DictionaryAddOnAndBuilder addOnById=AnyApplication.getExternalDictionaryFactory(mContext).getAddOnById(id);
      if (addOnById != null)       builders.add(addOnById);
    }
  }
  return builders;
}

Fixed version (ground truth):
@NonNull public List<DictionaryAddOnAndBuilder> getBuildersForKeyboard(AnyKeyboard keyboard){
  List<DictionaryAddOnAndBuilder> builders=new ArrayList<>();
  final String dictionaryValue=mSharedPreferences.getString(getDictionaryOverrideKey(keyboard),null);
  if (TextUtils.isEmpty(dictionaryValue)) {
    final DictionaryAddOnAndBuilder builderByLocale=AnyApplication.getExternalDictionaryFactory(mContext).getDictionaryBuilderByLocale(keyboard.getDefaultDictionaryLocale());
    if (builderByLocale != null)     builders.add(builderByLocale);
  }
 else {
    String[] ids=dictionaryValue.split("String_Node_Str",-1);
    for (    String id : ids) {
      final DictionaryAddOnAndBuilder addOnById=AnyApplication.getExternalDictionaryFactory(mContext).getAddOnById(id);
      if (addOnById != null)       builders.add(addOnById);
    }
  }
  return builders;
}
Program: 157126
Project: 157126
Buggy source:
@NonNull private int[] getKeyCodesFromPhysicalSequence(String keyCodesArray){
  String[] split=keyCodesArray.split("String_Node_Str");
  int[] keyCodes=new int[split.length];
  for (int i=0; i < keyCodes.length; i++) {
    try {
      keyCodes[i]=Integer.parseInt(split[i]);
    }
 catch (    final NumberFormatException nfe) {
      final String v=split[i];
      try {
        keyCodes[i]=android.view.KeyEvent.class.getField(v).getInt(null);
      }
 catch (      final Exception ex) {
        throw new RuntimeException(ex);
      }
    }
  }
  return keyCodes;
}

Fixed version (ground truth):
@NonNull private int[] getKeyCodesFromPhysicalSequence(String keyCodesArray){
  String[] split=keyCodesArray.split("String_Node_Str",-1);
  int[] keyCodes=new int[split.length];
  for (int i=0; i < keyCodes.length; i++) {
    try {
      keyCodes[i]=Integer.parseInt(split[i]);
    }
 catch (    final NumberFormatException nfe) {
      final String v=split[i];
      try {
        keyCodes[i]=android.view.KeyEvent.class.getField(v).getInt(null);
      }
 catch (      final Exception ex) {
        throw new RuntimeException(ex);
      }
    }
  }
  return keyCodes;
}
Program: 157127
Project: 157127
Buggy source:
public boolean setCondensedKeys(CondenseType condenseType,KeyboardDimens keyboardDimens){
  if (mKeyboardCondenseType.equals(condenseType))   return false;
  final float condensingFactor;
switch (condenseType) {
case CompactToLeft:
case CompactToRight:
    condensingFactor=mCondensingEdgeFactor;
  break;
default :
condensingFactor=mCondensingFullFactor;
break;
}
if (!condenseType.equals(CondenseType.None) && condensingFactor > 0.97f) return false;
final int halfHorizontalGap=(int)(keyboardDimens.getKeyHorizontalGap() / 2);
List<Key> keys=mKeyboard.getKeys();
if (mKeySizesMap == null) mKeySizesMap=new ArrayList<>(keys.size());
List<KeySize> stashedKeySizes=mKeySizesMap;
if (stashedKeySizes.size() > 0) {
if (stashedKeySizes.size() != keys.size()) throw new IllegalStateException("String_Node_Str");
for (int i=0; i < stashedKeySizes.size(); i++) {
Key k=keys.get(i);
KeySize originalSize=mKeySizesMap.get(i);
k.width=originalSize.width;
k.height=originalSize.height;
k.x=originalSize.X;
k.y=originalSize.Y;
}
}
mKeySizesMap.clear();
final int keyboardWidth=mKeyboard.getMinWidth();
switch (condenseType) {
case Split:
splitKeys(keyboardWidth,keyboardWidth / 2,halfHorizontalGap,condensingFactor);
break;
case CompactToLeft:
splitKeys(keyboardWidth,keyboardWidth,halfHorizontalGap,condensingFactor);
break;
case CompactToRight:
splitKeys(keyboardWidth,0,halfHorizontalGap,condensingFactor);
break;
case None:
break;
default :
throw new IllegalArgumentException("String_Node_Str" + condenseType);
}
mKeyboardCondenseType=condenseType;
return true;
}

Fixed version (ground truth):
public boolean setCondensedKeys(CondenseType condenseType,KeyboardDimens keyboardDimens){
  if (mKeyboardCondenseType.equals(condenseType))   return false;
  final float condensingFactor;
switch (condenseType) {
case CompactToLeft:
case CompactToRight:
    condensingFactor=mCondensingEdgeFactor;
  break;
default :
condensingFactor=mCondensingFullFactor;
break;
}
if (!condenseType.equals(CondenseType.None) && condensingFactor > 0.97f) return false;
final int halfHorizontalGap=(int)(keyboardDimens.getKeyHorizontalGap() / 2);
List<Key> keys=mKeyboard.getKeys();
if (mKeySizesMap == null) mKeySizesMap=new ArrayList<>(keys.size());
List<KeySize> stashedKeySizes=mKeySizesMap;
if (stashedKeySizes.size() > 0) {
if (stashedKeySizes.size() != keys.size()) throw new IllegalStateException("String_Node_Str");
for (int i=0; i < stashedKeySizes.size(); i++) {
Key k=keys.get(i);
KeySize originalSize=mKeySizesMap.get(i);
k.width=originalSize.width;
k.height=originalSize.height;
k.x=originalSize.x;
k.y=originalSize.y;
}
}
mKeySizesMap.clear();
final int keyboardWidth=mKeyboard.getMinWidth();
switch (condenseType) {
case Split:
splitKeys(keyboardWidth,keyboardWidth / 2,halfHorizontalGap,condensingFactor);
break;
case CompactToLeft:
splitKeys(keyboardWidth,keyboardWidth,halfHorizontalGap,condensingFactor);
break;
case CompactToRight:
splitKeys(keyboardWidth,0,halfHorizontalGap,condensingFactor);
break;
case None:
break;
default :
throw new IllegalArgumentException("String_Node_Str" + condenseType);
}
mKeyboardCondenseType=condenseType;
return true;
}
Program: 157128
Project: 157128
Buggy source:
public KeySize(int w,int h,int x,int y){
  width=w;
  height=h;
  X=x;
  Y=y;
}

Fixed version (ground truth):
KeySize(int w,int h,int x,int y){
  this.width=w;
  this.height=h;
  this.x=x;
  this.y=y;
}
Program: 157129
Project: 157129
Buggy source:
@RequiresApi(Build.VERSION_CODES.HONEYCOMB) private void loadKeyboardAppMapping(){
  Set<String> mapping=AnyApplication.prefs(mContext).getStringSet(R.string.settings_key_persistent_layout_per_package_id_mapping).get();
  for (  String aMapping : mapping) {
    String[] mapPair=aMapping.split(PACKAGE_ID_TO_KEYBOARD_ID_TOKEN);
    if (mapPair.length == 2) {
      mAlphabetKeyboardIndexByPackageId.put(mapPair[0],mapPair[1]);
    }
  }
}

Fixed version (ground truth):
@RequiresApi(Build.VERSION_CODES.HONEYCOMB) private void loadKeyboardAppMapping(){
  Set<String> mapping=AnyApplication.prefs(mContext).getStringSet(R.string.settings_key_persistent_layout_per_package_id_mapping).get();
  for (  String aMapping : mapping) {
    String[] mapPair=aMapping.split(PACKAGE_ID_TO_KEYBOARD_ID_TOKEN,-1);
    if (mapPair.length == 2) {
      mAlphabetKeyboardIndexByPackageId.put(mapPair[0],mapPair[1]);
    }
  }
}
Program: 157130
Project: 157130
Buggy source:
private static void decodeForOldDevices(@NonNull String encodedHistory,@NonNull List<HistoryKey> outputSet){
  String[] historyTokens=encodedHistory.split(HISTORY_TOKEN_SEPARATOR);
  int tokensIndex=0;
  while (tokensIndex + 1 < historyTokens.length && outputSet.size() < MAX_LIST_SIZE) {
    String name=historyTokens[tokensIndex];
    String value=historyTokens[tokensIndex + 1];
    if (!(TextUtils.isEmpty(name) || TextUtils.isEmpty(value))) {
      outputSet.add(new HistoryKey(name,value));
    }
    tokensIndex+=2;
  }
}

Fixed version (ground truth):
private static void decodeForOldDevices(@NonNull String encodedHistory,@NonNull List<HistoryKey> outputSet){
  String[] historyTokens=encodedHistory.split(HISTORY_TOKEN_SEPARATOR,-1);
  int tokensIndex=0;
  while (tokensIndex + 1 < historyTokens.length && outputSet.size() < MAX_LIST_SIZE) {
    String name=historyTokens[tokensIndex];
    String value=historyTokens[tokensIndex + 1];
    if (!(TextUtils.isEmpty(name) || TextUtils.isEmpty(value))) {
      outputSet.add(new HistoryKey(name,value));
    }
    tokensIndex+=2;
  }
}
Program: 157131
Project: 157131
Buggy source:
@VisibleForTesting static boolean isThisKeyboardEnabled(String enabledIMEList,String myPackageName){
  if (TextUtils.isEmpty(enabledIMEList))   return false;
  String[] enabledIMEs=enabledIMEList.split("String_Node_Str");
  for (  String enabledIMEId : enabledIMEs) {
    ComponentName enabledIME=ComponentName.unflattenFromString(enabledIMEId);
    if (enabledIME != null && enabledIME.getPackageName().equals(myPackageName)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@VisibleForTesting static boolean isThisKeyboardEnabled(String enabledIMEList,String myPackageName){
  if (TextUtils.isEmpty(enabledIMEList))   return false;
  String[] enabledIMEs=enabledIMEList.split("String_Node_Str",-1);
  for (  String enabledIMEId : enabledIMEs) {
    ComponentName enabledIME=ComponentName.unflattenFromString(enabledIMEId);
    if (enabledIME != null && enabledIME.getPackageName().equals(myPackageName)) {
      return true;
    }
  }
  return false;
}
Program: 157132
Project: 157132
Buggy source:
protected void onStorageChanged(){
  if (isClosed())   return;
  clearDictionary();
  mDictionaryChangedLoader=DictionaryBackgroundLoader.loadDictionaryInBackground(this);
}

Fixed version (ground truth):
protected void onStorageChanged(){
  if (isClosed())   return;
  clearDictionary();
  mDictionaryChangedLoader=DictionaryBackgroundLoader.reloadDictionaryInBackground(this);
}
Program: 157134
Project: 157134
Buggy source:
@CallSuper protected boolean handleCloseRequest(){
  if (mOptionsDialog != null && mOptionsDialog.isShowing()) {
    mOptionsDialog.dismiss();
    mOptionsDialog=null;
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@CallSuper protected boolean handleCloseRequest(){
  if (mOptionsDialog != null && mOptionsDialog.isShowing()) {
    mOptionsDialog.dismiss();
    mOptionsDialog=null;
    return true;
  }
 else   if (mUtilityKeyboardShown) {
    super.hideWindow();
    return false;
  }
 else {
    return false;
  }
}
Program: 157136
Project: 157136
Buggy source:
public synchronized void setKeys(Iterable<Keyboard.Key> keys,Context context,int width,int height){
  if (mWordsCornersState == LoadingState.LOADING)   return;
  if (mWordsCornersState == LoadingState.LOADED && keys.equals(mKeys) && mWidth == width && mHeight == height)   return;
  this.mKeys=keys;
  this.mWidth=width;
  this.mHeight=height;
  mGeneratingDisposable.dispose();
  mGeneratingDisposable=generateCornersInBackground(mWords,mWordsCorners,keys);
}

Fixed version (ground truth):
public void setKeys(Iterable<Keyboard.Key> keys,Context context,int width,int height){
  if (mWordsCornersState == LoadingState.LOADING)   return;
  if (mWordsCornersState == LoadingState.LOADED && keys.equals(mKeys) && mWidth == width && mHeight == height)   return;
  this.mKeys=keys;
  this.mWidth=width;
  this.mHeight=height;
  mGeneratingDisposable.dispose();
  mGeneratingDisposable=generateCornersInBackground(mWords,mWordsCorners,keys);
}
Program: 157137
Project: 157137
Buggy source:
public PopupListKeyboard(@NonNull AddOn keyboardAddOn,Context askContext,KeyboardDimens keyboardDimens,List<String> keysNames,List<String> keyValues,CharSequence name){
  super(keyboardAddOn,askContext,askContext,R.xml.quick_text_list_popup,keyboardDimens,name);
  int rowWidth=0;
  Key baseKey=getKeys().get(0);
  Row row=baseKey.row;
  final float y=baseKey.y;
  final float keyHorizontalGap=row.defaultHorizontalGap;
  baseKey.mCodes=new int[]{0};
  baseKey.label=keysNames.get(0);
  baseKey.text=keyValues.get(0);
  float x=baseKey.width;
  Key aKey=null;
  for (int entryIndex=1; entryIndex < keysNames.size(); entryIndex++) {
    x+=(keyHorizontalGap / 2);
    aKey=new AnyKey(row,keyboardDimens);
    aKey.mCodes=new int[]{0};
    aKey.label=keysNames.get(entryIndex);
    aKey.text=keyValues.get(entryIndex);
    aKey.x=(int)x;
    aKey.width=(int)(aKey.width - keyHorizontalGap);
    aKey.y=(int)y;
    final int xOffset=(int)(aKey.width + keyHorizontalGap + (keyHorizontalGap / 2));
    x+=xOffset;
    rowWidth+=xOffset;
    getKeys().add(aKey);
  }
  baseKey.edgeFlags=EDGE_LEFT;
  if (aKey != null)   aKey.edgeFlags=EDGE_RIGHT;
 else   baseKey.edgeFlags|=EDGE_RIGHT;
  mAdditionalWidth=rowWidth;
}

Fixed version (ground truth):
public PopupListKeyboard(@NonNull AddOn keyboardAddOn,Context askContext,KeyboardDimens keyboardDimens,List<String> keysNames,List<String> keyValues,CharSequence name){
  super(keyboardAddOn,askContext,askContext,R.xml.quick_text_list_popup,keyboardDimens,name);
  int rowWidth=0;
  Key baseKey=getKeys().get(0);
  Row row=baseKey.row;
  final float y=baseKey.y;
  final float keyHorizontalGap=row.defaultHorizontalGap;
  baseKey.mCodes=new int[]{0};
  baseKey.label=keysNames.get(0);
  baseKey.text=keyValues.get(0);
  float x=baseKey.width;
  AnyKey aKey=null;
  for (int entryIndex=1; entryIndex < keysNames.size(); entryIndex++) {
    x+=(keyHorizontalGap / 2);
    aKey=new AnyKey(row,keyboardDimens);
    aKey.mCodes=new int[]{0};
    aKey.mShiftedCodes=new int[]{0};
    aKey.label=keysNames.get(entryIndex);
    aKey.text=keyValues.get(entryIndex);
    aKey.x=(int)x;
    aKey.width=(int)(aKey.width - keyHorizontalGap);
    aKey.y=(int)y;
    final int xOffset=(int)(aKey.width + keyHorizontalGap + (keyHorizontalGap / 2));
    x+=xOffset;
    rowWidth+=xOffset;
    getKeys().add(aKey);
  }
  baseKey.edgeFlags=EDGE_LEFT;
  if (aKey != null)   aKey.edgeFlags=EDGE_RIGHT;
 else   baseKey.edgeFlags|=EDGE_RIGHT;
  mAdditionalWidth=rowWidth;
}
Program: 157139
Project: 157139
Buggy source:
public void addNextState(int keyCode,KeyEventState next){
  if (this.mTransitions == null)   this.mTransitions=new LinkedList<>();
  this.mTransitions.add(new KeyEventTransition(keyCode,next));
}

Fixed version (ground truth):
public void addNextState(int keyCode,KeyEventState next){
  if (this.mTransitions == null)   this.mTransitions=new ArrayList<>();
  this.mTransitions.add(new KeyEventTransition(keyCode,next));
}
Program: 157140
Project: 157140
Buggy source:
private void condenseRightSide(final float condensingFactor,final int keyboardWidth,int currentRightX,Stack<Key> rightKeys,Key spaceKey){
  currentRightX=(int)(keyboardWidth - ((keyboardWidth - currentRightX) * condensingFactor));
  while (!rightKeys.isEmpty()) {
    Key rightKey=rightKeys.pop();
    currentRightX-=rightKey.width;
    rightKey.x=currentRightX;
    currentRightX=(int)(currentRightX - (rightKey.gap * condensingFactor));
  }
  if (spaceKey != null) {
    spaceKey.width=currentRightX - spaceKey.x;
  }
}

Fixed version (ground truth):
private void condenseRightSide(final float condensingFactor,final int keyboardWidth,int currentRightX,Deque<Key> rightKeys,Key spaceKey){
  currentRightX=(int)(keyboardWidth - ((keyboardWidth - currentRightX) * condensingFactor));
  while (!rightKeys.isEmpty()) {
    Key rightKey=rightKeys.pop();
    currentRightX-=rightKey.width;
    rightKey.x=currentRightX;
    currentRightX=(int)(currentRightX - (rightKey.gap * condensingFactor));
  }
  if (spaceKey != null) {
    spaceKey.width=currentRightX - spaceKey.x;
  }
}
Program: 157141
Project: 157141
Buggy source:
private void splitKeys(final int keyboardWidth,final int watershedLineX,final float condensingFactor){
  int currentLeftX=0;
  int currentRightX=keyboardWidth;
  int currentY=0;
  Stack<Key> rightKeys=new Stack<>();
  boolean flipSideLeft=true;
  Key spaceKey=null;
  for (  Key k : mKeyboard.getKeys()) {
    mKeySizesMap.add(new KeySize(k.width,k.height,k.x,k.y));
    if (currentY != k.y) {
      flipSideLeft=!flipSideLeft;
      condenseRightSide(condensingFactor,keyboardWidth,currentRightX,rightKeys,spaceKey);
      currentLeftX=0;
      currentRightX=keyboardWidth;
      currentY=k.y;
      rightKeys.clear();
    }
    int targetWidth=(int)(k.width * condensingFactor);
    int keyMidPoint=(k.gap + k.x + (k.width / 2));
    if (k.getPrimaryCode() == KeyCodes.SPACE && (k.gap + k.x) < watershedLineX && (k.gap + k.x + k.width) > watershedLineX) {
      spaceKey=k;
      currentLeftX=condenseLeftSide(condensingFactor,currentLeftX,k,targetWidth);
    }
 else     if (keyMidPoint < (watershedLineX - 5)) {
      currentLeftX=condenseLeftSide(condensingFactor,currentLeftX,k,targetWidth);
    }
 else     if (keyMidPoint > (watershedLineX + 5)) {
      currentRightX=stackRightSideKeyForLater(rightKeys,k,targetWidth);
    }
 else {
      if (flipSideLeft) {
        currentLeftX=condenseLeftSide(condensingFactor,currentLeftX,k,targetWidth);
      }
 else {
        currentRightX=stackRightSideKeyForLater(rightKeys,k,targetWidth);
      }
    }
  }
  condenseRightSide(condensingFactor,keyboardWidth,currentRightX,rightKeys,spaceKey);
}

Fixed version (ground truth):
private void splitKeys(final int keyboardWidth,final int watershedLineX,final float condensingFactor){
  int currentLeftX=0;
  int currentRightX=keyboardWidth;
  int currentY=0;
  Deque<Key> rightKeys=new ArrayDeque<>();
  boolean flipSideLeft=true;
  Key spaceKey=null;
  for (  Key k : mKeyboard.getKeys()) {
    mKeySizesMap.add(new KeySize(k.width,k.height,k.x,k.y));
    if (currentY != k.y) {
      flipSideLeft=!flipSideLeft;
      condenseRightSide(condensingFactor,keyboardWidth,currentRightX,rightKeys,spaceKey);
      currentLeftX=0;
      currentRightX=keyboardWidth;
      currentY=k.y;
      rightKeys.clear();
    }
    int targetWidth=(int)(k.width * condensingFactor);
    int keyMidPoint=(k.gap + k.x + (k.width / 2));
    if (k.getPrimaryCode() == KeyCodes.SPACE && (k.gap + k.x) < watershedLineX && (k.gap + k.x + k.width) > watershedLineX) {
      spaceKey=k;
      currentLeftX=condenseLeftSide(condensingFactor,currentLeftX,k,targetWidth);
    }
 else     if (keyMidPoint < (watershedLineX - 5)) {
      currentLeftX=condenseLeftSide(condensingFactor,currentLeftX,k,targetWidth);
    }
 else     if (keyMidPoint > (watershedLineX + 5)) {
      currentRightX=stackRightSideKeyForLater(rightKeys,k,targetWidth);
    }
 else {
      if (flipSideLeft) {
        currentLeftX=condenseLeftSide(condensingFactor,currentLeftX,k,targetWidth);
      }
 else {
        currentRightX=stackRightSideKeyForLater(rightKeys,k,targetWidth);
      }
    }
  }
  condenseRightSide(condensingFactor,keyboardWidth,currentRightX,rightKeys,spaceKey);
}
Program: 157142
Project: 157142
Buggy source:
private int stackRightSideKeyForLater(Stack<Key> rightKeys,Key k,int targetWidth){
  int currentRightX;
  rightKeys.push(k);
  currentRightX=k.x + k.width;
  k.width=targetWidth;
  return currentRightX;
}

Fixed version (ground truth):
private int stackRightSideKeyForLater(Deque<Key> rightKeys,Key k,int targetWidth){
  int currentRightX;
  rightKeys.push(k);
  currentRightX=k.x + k.width;
  k.width=targetWidth;
  return currentRightX;
}
Program: 157143
Project: 157143
Buggy source:
public int lastIndexOf(PointerTracker tracker){
  LinkedList<PointerTracker> queue=mQueue;
  for (int index=queue.size() - 1; index >= 0; index--) {
    PointerTracker t=queue.get(index);
    if (t == tracker)     return index;
  }
  return -1;
}

Fixed version (ground truth):
public int lastIndexOf(PointerTracker tracker){
  ArrayList<PointerTracker> queue=mQueue;
  for (int index=queue.size() - 1; index >= 0; index--) {
    PointerTracker t=queue.get(index);
    if (t == tracker)     return index;
  }
  return -1;
}
Program: 157144
Project: 157144
Buggy source:
public static int editDistance(@NonNull CharSequence s,@NonNull CharSequence t){
  final int sl=s.length();
  final int tl=t.length();
  int[][] dp=new int[sl + 1][tl + 1];
  for (int i=0; i <= sl; i++) {
    dp[i][0]=i;
  }
  for (int j=0; j <= tl; j++) {
    dp[0][j]=j;
  }
  for (int i=0; i < sl; ++i) {
    for (int j=0; j < tl; ++j) {
      final char sc=Character.toLowerCase(s.charAt(i));
      final char tc=Character.toLowerCase(t.charAt(j));
      final int cost=sc == tc ? 0 : 1;
      dp[i + 1][j + 1]=Math.min(dp[i][j + 1] + 1,Math.min(dp[i + 1][j] + 1,dp[i][j] + cost));
      if (i > 0 && j > 0 && sc == Character.toLowerCase(t.charAt(j - 1)) && tc == Character.toLowerCase(s.charAt(i - 1))) {
        dp[i + 1][j + 1]=Math.min(dp[i + 1][j + 1],dp[i - 1][j - 1] + cost);
      }
    }
  }
  if (BuildConfig.DEBUG) {
    Logger.d(TAG,"String_Node_Str" + s + "String_Node_Str"+ t);
    for (int i=0; i < dp.length; ++i) {
      StringBuffer sb=new StringBuffer();
      for (int j=0; j < dp[i].length; ++j) {
        sb.append(dp[i][j]).append(',');
      }
      Logger.d(TAG,i + "String_Node_Str" + sb.toString());
    }
  }
  return dp[sl][tl];
}

Fixed version (ground truth):
public static int editDistance(@NonNull CharSequence s,@NonNull CharSequence t){
  final int sl=s.length();
  final int tl=t.length();
  int[][] dp=new int[sl + 1][tl + 1];
  for (int i=0; i <= sl; i++) {
    dp[i][0]=i;
  }
  for (int j=0; j <= tl; j++) {
    dp[0][j]=j;
  }
  for (int i=0; i < sl; ++i) {
    for (int j=0; j < tl; ++j) {
      final char sc=Character.toLowerCase(s.charAt(i));
      final char tc=Character.toLowerCase(t.charAt(j));
      final int cost=sc == tc ? 0 : 1;
      dp[i + 1][j + 1]=Math.min(dp[i][j + 1] + 1,Math.min(dp[i + 1][j] + 1,dp[i][j] + cost));
      if (i > 0 && j > 0 && sc == Character.toLowerCase(t.charAt(j - 1)) && tc == Character.toLowerCase(s.charAt(i - 1))) {
        dp[i + 1][j + 1]=Math.min(dp[i + 1][j + 1],dp[i - 1][j - 1] + cost);
      }
    }
  }
  if (BuildConfig.DEBUG) {
    StringBuilder sb=new StringBuilder();
    sb.append("String_Node_Str").append(s).append("String_Node_Str").append(t);
    Logger.d(TAG,sb.toString());
    for (int i=0; i < dp.length; ++i) {
      sb.setLength(0);
      sb.append(i).append(':');
      for (int j=0; j < dp[i].length; ++j) {
        sb.append(dp[i][j]).append(',');
      }
      Logger.d(TAG,sb.toString());
    }
  }
  return dp[sl][tl];
}
Program: 157145
Project: 157145
Buggy source:
/** 
 * Begin to output an entity.
 * @param name name of entity.
 */
public XmlWriter writeEntity(String name) throws IOException {
  closeOpeningTag(true);
  this.mClosed=false;
  for (int tabIndex=0; tabIndex < mStack.size() + mIndentingOffset; tabIndex++)   this.mWriter.write(INDENT_STRING);
  this.mWriter.write("String_Node_Str");
  this.mWriter.write(name);
  mStack.add(name);
  this.mEmpty=true;
  this.mJustWroteText=false;
  return this;
}

Fixed version (ground truth):
/** 
 * Begin to output an entity.
 * @param name name of entity.
 */
public XmlWriter writeEntity(String name) throws IOException {
  closeOpeningTag(true);
  this.mClosed=false;
  for (int tabIndex=0; tabIndex < mStack.size() + mIndentingOffset; tabIndex++)   this.mWriter.write(INDENT_STRING);
  this.mWriter.write("String_Node_Str");
  this.mWriter.write(name);
  mStack.push(name);
  this.mEmpty=true;
  this.mJustWroteText=false;
  return this;
}
Program: 157146
Project: 157146
Buggy source:
/** 
 * End the current entity. This will throw an exception if it is called when there is not a currently open entity.
 * @throws IOException
 */
public XmlWriter endEntity() throws IOException {
  if (this.mStack.empty()) {
    throw new InvalidObjectException("String_Node_Str");
  }
  String name=this.mStack.pop();
  if (name != null) {
    if (this.mEmpty) {
      writeAttributes();
      this.mWriter.write("String_Node_Str");
    }
 else {
      if (!this.mJustWroteText) {
        for (int tabIndex=0; tabIndex < mStack.size() + mIndentingOffset; tabIndex++)         this.mWriter.write(INDENT_STRING);
      }
      this.mWriter.write("String_Node_Str");
      this.mWriter.write(name);
      this.mWriter.write("String_Node_Str");
    }
    this.mEmpty=false;
    this.mClosed=true;
    this.mJustWroteText=false;
  }
  return this;
}

Fixed version (ground truth):
/** 
 * End the current entity. This will throw an exception if it is called when there is not a currently open entity.
 * @throws IOException
 */
public XmlWriter endEntity() throws IOException {
  if (mStack.size() == 0) {
    throw new InvalidObjectException("String_Node_Str");
  }
  String name=mStack.pop();
  if (mEmpty) {
    writeAttributes();
    mWriter.write("String_Node_Str");
  }
 else {
    if (!mJustWroteText) {
      for (int tabIndex=0; tabIndex < mStack.size() + mIndentingOffset; tabIndex++)       mWriter.write(INDENT_STRING);
    }
    mWriter.write("String_Node_Str");
    mWriter.write(name);
    mWriter.write("String_Node_Str");
  }
  mEmpty=false;
  mClosed=true;
  mJustWroteText=false;
  return this;
}
Program: 157147
Project: 157147
Buggy source:
/** 
 * Close this mWriter. It does not close the underlying mWriter, but does throw an exception if there are as yet unclosed tags.
 * @throws IOException
 */
public void close() throws IOException {
  if (!this.mStack.empty()) {
    throw new InvalidObjectException("String_Node_Str" + "String_Node_Str" + this.mStack.pop() + "String_Node_Str");
  }
  if (mThisIsWriterOwner) {
    this.mWriter.flush();
    this.mWriter.close();
  }
}

Fixed version (ground truth):
/** 
 * Close this mWriter. It does not close the underlying mWriter, but does throw an exception if there are as yet unclosed tags.
 * @throws IOException
 */
public void close() throws IOException {
  if (this.mStack.size() > 0) {
    throw new InvalidObjectException("String_Node_Str" + "String_Node_Str" + this.mStack.pop() + "String_Node_Str");
  }
  if (mThisIsWriterOwner) {
    this.mWriter.flush();
    this.mWriter.close();
  }
}
Program: 157148
Project: 157148
Buggy source:
@Test public void testNavigationSupportedRowsAndCancel(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  fragment.findPreference("String_Node_Str").performClick();
  Robolectric.flushForegroundThreadScheduler();
  AlertDialog latestAlertDialog=ShadowAlertDialog.getLatestAlertDialog();
  Assert.assertNotNull(latestAlertDialog);
  ShadowAlertDialog shadowAlertDialog=Shadows.shadowOf(latestAlertDialog);
  Assert.assertTrue(AnyApplication.getConfig().isEnableStateForRowMode(Keyboard.KEYBOARD_ROW_MODE_EMAIL));
  shadowAlertDialog.clickOnItem(2);
  latestAlertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();
  Assert.assertTrue(shadowAlertDialog.hasBeenDismissed());
}

Fixed version (ground truth):
@Test public void testNavigationSupportedRowsAndCancel(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  ViewTestUtils.performClick(fragment.findPreference("String_Node_Str"));
  Robolectric.flushForegroundThreadScheduler();
  AlertDialog latestAlertDialog=ShadowAlertDialog.getLatestAlertDialog();
  Assert.assertNotNull(latestAlertDialog);
  ShadowAlertDialog shadowAlertDialog=Shadows.shadowOf(latestAlertDialog);
  Assert.assertTrue(AnyApplication.getConfig().isEnableStateForRowMode(Keyboard.KEYBOARD_ROW_MODE_EMAIL));
  shadowAlertDialog.clickOnItem(2);
  latestAlertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();
  Assert.assertTrue(shadowAlertDialog.hasBeenDismissed());
}
Program: 157149
Project: 157149
Buggy source:
@Test public void testNavigationTweaks(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  fragment.findPreference("String_Node_Str").performClick();
  Robolectric.flushForegroundThreadScheduler();
  final Fragment next=fragment.getActivity().getSupportFragmentManager().findFragmentById(R.id.main_ui_content);
  Assert.assertTrue(next instanceof UiTweaksFragment);
}

Fixed version (ground truth):
@Test public void testNavigationTweaks(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  ViewTestUtils.performClick(fragment.findPreference("String_Node_Str"));
  Robolectric.flushForegroundThreadScheduler();
  final Fragment next=fragment.getActivity().getSupportFragmentManager().findFragmentById(R.id.main_ui_content);
  Assert.assertTrue(next instanceof UiTweaksFragment);
}
Program: 157150
Project: 157150
Buggy source:
@Test public void testNavigationSupportedRowsAndHappyPath(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  fragment.findPreference("String_Node_Str").performClick();
  Robolectric.flushForegroundThreadScheduler();
  AlertDialog latestAlertDialog=ShadowAlertDialog.getLatestAlertDialog();
  Assert.assertNotNull(latestAlertDialog);
  ShadowAlertDialog shadowAlertDialog=Shadows.shadowOf(latestAlertDialog);
  Assert.assertEquals(4,shadowAlertDialog.getItems().length);
  Assert.assertEquals("String_Node_Str",shadowAlertDialog.getItems()[0]);
  Assert.assertEquals("String_Node_Str",shadowAlertDialog.getItems()[1]);
  Assert.assertEquals("String_Node_Str",shadowAlertDialog.getItems()[2]);
  Assert.assertEquals("String_Node_Str",shadowAlertDialog.getItems()[3]);
  Assert.assertTrue(AnyApplication.getConfig().isEnableStateForRowMode(Keyboard.KEYBOARD_ROW_MODE_EMAIL));
  shadowAlertDialog.clickOnItem(2);
  Assert.assertFalse(shadowAlertDialog.hasBeenDismissed());
  latestAlertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
  Assert.assertTrue(shadowAlertDialog.hasBeenDismissed());
  Assert.assertFalse(AnyApplication.getConfig().isEnableStateForRowMode(Keyboard.KEYBOARD_ROW_MODE_EMAIL));
}

Fixed version (ground truth):
@Test public void testNavigationSupportedRowsAndHappyPath(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  ViewTestUtils.performClick(fragment.findPreference("String_Node_Str"));
  Robolectric.flushForegroundThreadScheduler();
  AlertDialog latestAlertDialog=ShadowAlertDialog.getLatestAlertDialog();
  Assert.assertNotNull(latestAlertDialog);
  ShadowAlertDialog shadowAlertDialog=Shadows.shadowOf(latestAlertDialog);
  Assert.assertEquals(4,shadowAlertDialog.getItems().length);
  Assert.assertEquals("String_Node_Str",shadowAlertDialog.getItems()[0]);
  Assert.assertEquals("String_Node_Str",shadowAlertDialog.getItems()[1]);
  Assert.assertEquals("String_Node_Str",shadowAlertDialog.getItems()[2]);
  Assert.assertEquals("String_Node_Str",shadowAlertDialog.getItems()[3]);
  Assert.assertTrue(AnyApplication.getConfig().isEnableStateForRowMode(Keyboard.KEYBOARD_ROW_MODE_EMAIL));
  shadowAlertDialog.clickOnItem(2);
  Assert.assertFalse(shadowAlertDialog.hasBeenDismissed());
  latestAlertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
  Assert.assertTrue(shadowAlertDialog.hasBeenDismissed());
  Assert.assertFalse(AnyApplication.getConfig().isEnableStateForRowMode(Keyboard.KEYBOARD_ROW_MODE_EMAIL));
}
Program: 157151
Project: 157151
Buggy source:
@Test public void testNavigationCommonBottomRow(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  fragment.findPreference("String_Node_Str").performClick();
  Robolectric.flushForegroundThreadScheduler();
  final Fragment next=fragment.getActivity().getSupportFragmentManager().findFragmentById(R.id.main_ui_content);
  Assert.assertTrue(next instanceof AdditionalUiSettingsFragment.BottomRowAddOnBrowserFragment);
}

Fixed version (ground truth):
@Test public void testNavigationCommonBottomRow(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  ViewTestUtils.performClick(fragment.findPreference("String_Node_Str"));
  Robolectric.flushForegroundThreadScheduler();
  final Fragment next=fragment.getActivity().getSupportFragmentManager().findFragmentById(R.id.main_ui_content);
  Assert.assertTrue(next instanceof AdditionalUiSettingsFragment.BottomRowAddOnBrowserFragment);
}
Program: 157152
Project: 157152
Buggy source:
@Test public void testNavigationCommonTopRow(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  fragment.findPreference("String_Node_Str").performClick();
  Robolectric.flushForegroundThreadScheduler();
  final Fragment next=fragment.getActivity().getSupportFragmentManager().findFragmentById(R.id.main_ui_content);
  Assert.assertTrue(next instanceof AdditionalUiSettingsFragment.TopRowAddOnBrowserFragment);
}

Fixed version (ground truth):
@Test public void testNavigationCommonTopRow(){
  final AdditionalUiSettingsFragment fragment=startFragment();
  ViewTestUtils.performClick(fragment.findPreference("String_Node_Str"));
  Robolectric.flushForegroundThreadScheduler();
  final Fragment next=fragment.getActivity().getSupportFragmentManager().findFragmentById(R.id.main_ui_content);
  Assert.assertTrue(next instanceof AdditionalUiSettingsFragment.TopRowAddOnBrowserFragment);
}
Program: 157153
Project: 157153
Buggy source:
public void run(){
  mList.focusableViewAvailable(mList);
}

Fixed version (ground truth):
@Override public void run(){
  mList.focusableViewAvailable(mList);
}
Program: 157154
Project: 157154
Buggy source:
/** 
 * {@inheritDoc}
 */
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  if (getActivity() instanceof OnPreferenceStartFragmentCallback) {
    return ((OnPreferenceStartFragmentCallback)getActivity()).onPreferenceStartFragment(this,preference);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  if (getActivity() instanceof OnPreferenceStartFragmentCallback) {
    return ((OnPreferenceStartFragmentCallback)getActivity()).onPreferenceStartFragment(this,preference);
  }
  return false;
}
Program: 157155
Project: 157155
Buggy source:
public Object invoke(Object proxy,Method method,Object[] args){
  if (method.getName().equals("String_Node_Str")) {
    return Boolean.valueOf(listener.onPreferenceTreeClick((PreferenceScreen)args[0],(Preference)args[1]));
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public Object invoke(Object proxy,Method method,Object[] args){
  if (method.getName().equals("String_Node_Str")) {
    return listener.onPreferenceTreeClick((PreferenceScreen)args[0],(Preference)args[1]);
  }
 else {
    return null;
  }
}
Program: 157156
Project: 157156
Buggy source:
/** 
 * Sets the callback to be invoked when a   {@link Preference} in thehierarchy rooted at this  {@link PreferenceManager} is clicked.
 * @param listener The callback to be invoked.
 */
static void setOnPreferenceTreeClickListener(PreferenceManager manager,final OnPreferenceTreeClickListener listener){
  try {
    Field onPreferenceTreeClickListener=PreferenceManager.class.getDeclaredField("String_Node_Str");
    onPreferenceTreeClickListener.setAccessible(true);
    if (listener != null) {
      Object proxy=Proxy.newProxyInstance(onPreferenceTreeClickListener.getType().getClassLoader(),new Class[]{onPreferenceTreeClickListener.getType()},new InvocationHandler(){
        public Object invoke(        Object proxy,        Method method,        Object[] args){
          if (method.getName().equals("String_Node_Str")) {
            return Boolean.valueOf(listener.onPreferenceTreeClick((PreferenceScreen)args[0],(Preference)args[1]));
          }
 else {
            return null;
          }
        }
      }
);
      onPreferenceTreeClickListener.set(manager,proxy);
    }
 else {
      onPreferenceTreeClickListener.set(manager,null);
    }
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Sets the callback to be invoked when a   {@link Preference} in thehierarchy rooted at this  {@link PreferenceManager} is clicked.
 * @param listener The callback to be invoked.
 */
static void setOnPreferenceTreeClickListener(PreferenceManager manager,final OnPreferenceTreeClickListener listener){
  try {
    Field onPreferenceTreeClickListener=PreferenceManager.class.getDeclaredField("String_Node_Str");
    onPreferenceTreeClickListener.setAccessible(true);
    if (listener != null) {
      Object proxy=Proxy.newProxyInstance(onPreferenceTreeClickListener.getType().getClassLoader(),new Class[]{onPreferenceTreeClickListener.getType()},new InvocationHandler(){
        @Override public Object invoke(        Object proxy,        Method method,        Object[] args){
          if (method.getName().equals("String_Node_Str")) {
            return listener.onPreferenceTreeClick((PreferenceScreen)args[0],(Preference)args[1]);
          }
 else {
            return null;
          }
        }
      }
);
      onPreferenceTreeClickListener.set(manager,proxy);
    }
 else {
      onPreferenceTreeClickListener.set(manager,null);
    }
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str",e);
  }
}
Program: 157157
Project: 157157
Buggy source:
public void onText(Key key,CharSequence text){
  Logger.d(TAG,"String_Node_Str",text);
  InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.beginBatchEdit();
  abortCorrectionAndResetPredictionState(false);
  ic.commitText(text,1);
  mJustAddedAutoSpace=false;
  mCommittedWord=text;
  mUndoCommitCursorPosition=UNDO_COMMIT_WAITING_TO_RECORD_POSITION;
  TextEntryState.acceptedDefault(text);
  ic.endBatchEdit();
  setSuggestions(mSuggest.getNextSuggestions(mCommittedWord,false),false,false,false);
}

Fixed version (ground truth):
@Override public void onText(Key key,CharSequence text){
  Logger.d(TAG,"String_Node_Str",text);
  InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.beginBatchEdit();
  abortCorrectionAndResetPredictionState(false);
  ic.commitText(text,1);
  mJustAddedAutoSpace=false;
  mCommittedWord=text;
  mUndoCommitCursorPosition=UNDO_COMMIT_WAITING_TO_RECORD_POSITION;
  TextEntryState.acceptedDefault(text);
  ic.endBatchEdit();
  setSuggestions(mSuggest.getNextSuggestions(mCommittedWord,false),false,false,false);
}
Program: 157158
Project: 157158
Buggy source:
private void showLanguageSelectionDialog(){
  KeyboardAddOnAndBuilder[] builders=getKeyboardSwitcher().getEnabledKeyboardsBuilders();
  ArrayList<CharSequence> keyboardsIds=new ArrayList<>();
  ArrayList<CharSequence> keyboards=new ArrayList<>();
  for (  KeyboardAddOnAndBuilder keyboardBuilder : builders) {
    keyboardsIds.add(keyboardBuilder.getId());
    CharSequence name=keyboardBuilder.getName();
    keyboards.add(name);
  }
  final CharSequence[] ids=new CharSequence[keyboardsIds.size()];
  final CharSequence[] items=new CharSequence[keyboards.size()];
  keyboardsIds.toArray(ids);
  keyboards.toArray(items);
  showOptionsDialogWithData(getText(R.string.select_keyboard_popup_title),R.drawable.ic_keyboard_globe_menu,items,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface di,    int position){
      CharSequence id=ids[position];
      Logger.d(TAG,"String_Node_Str",items[position],id);
      EditorInfo currentEditorInfo=getCurrentInputEditorInfo();
      getKeyboardSwitcher().nextAlphabetKeyboard(currentEditorInfo,id.toString());
    }
  }
);
}

Fixed version (ground truth):
private void showLanguageSelectionDialog(){
  KeyboardAddOnAndBuilder[] builders=getKeyboardSwitcher().getEnabledKeyboardsBuilders();
  ArrayList<CharSequence> keyboardsIds=new ArrayList<>();
  ArrayList<CharSequence> keyboards=new ArrayList<>();
  for (  KeyboardAddOnAndBuilder keyboardBuilder : builders) {
    keyboardsIds.add(keyboardBuilder.getId());
    CharSequence name=keyboardBuilder.getName();
    keyboards.add(name);
  }
  final CharSequence[] ids=new CharSequence[keyboardsIds.size()];
  final CharSequence[] items=new CharSequence[keyboards.size()];
  keyboardsIds.toArray(ids);
  keyboards.toArray(items);
  showOptionsDialogWithData(getText(R.string.select_keyboard_popup_title),R.drawable.ic_keyboard_globe_menu,items,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface di,    int position){
      CharSequence id=ids[position];
      Logger.d(TAG,"String_Node_Str",items[position],id);
      EditorInfo currentEditorInfo=getCurrentInputEditorInfo();
      getKeyboardSwitcher().nextAlphabetKeyboard(currentEditorInfo,id.toString());
    }
  }
);
}
Program: 157159
Project: 157159
Buggy source:
public void onCancel(){
}

Fixed version (ground truth):
@Override public void onCancel(){
}
Program: 157161
Project: 157161
Buggy source:
public void onMultiTapStarted(){
  final InputConnection ic=getCurrentInputConnection();
  if (ic != null)   ic.beginBatchEdit();
  handleDeleteLastCharacter(true);
  if (getInputView() != null)   getInputView().setShifted(mLastCharacterWasShifted);
}

Fixed version (ground truth):
@Override public void onMultiTapStarted(){
  final InputConnection ic=getCurrentInputConnection();
  if (ic != null)   ic.beginBatchEdit();
  handleDeleteLastCharacter(true);
  if (getInputView() != null)   getInputView().setShifted(mLastCharacterWasShifted);
}
Program: 157162
Project: 157162
Buggy source:
public void setSuggestions(List<? extends CharSequence> suggestions,boolean completions,boolean typedWordValid,boolean haveMinimalSuggestion){
  if (mCandidateView != null) {
    mCandidateView.setSuggestions(suggestions,completions,typedWordValid,haveMinimalSuggestion && isAutoCorrect());
  }
}

Fixed version (ground truth):
@Override public void setSuggestions(List<? extends CharSequence> suggestions,boolean completions,boolean typedWordValid,boolean haveMinimalSuggestion){
  if (mCandidateView != null) {
    mCandidateView.setSuggestions(suggestions,completions,typedWordValid,haveMinimalSuggestion && isAutoCorrect());
  }
}
Program: 157163
Project: 157163
Buggy source:
public void onPress(int primaryCode){
  super.onPress(primaryCode);
  InputConnection ic=getCurrentInputConnection();
  if (mVibrationDuration > 0 && primaryCode != 0 && mVibrator != null) {
    try {
      mVibrator.vibrate(mVibrationDuration);
    }
 catch (    Exception e) {
      Logger.w(TAG,"String_Node_Str");
      mVibrationDuration=0;
    }
  }
  if (primaryCode == KeyCodes.SHIFT) {
    mShiftKeyState.onPress();
    handleShift();
  }
 else {
    mShiftKeyState.onOtherKeyPressed();
  }
  if (primaryCode == KeyCodes.CTRL) {
    mControlKeyState.onPress();
    handleControl();
    sendKeyDown(ic,113);
  }
 else {
    mControlKeyState.onOtherKeyPressed();
  }
  if (mSoundOn && (!mSilentMode) && primaryCode != 0) {
    final int keyFX;
switch (primaryCode) {
case 13:
case KeyCodes.ENTER:
      keyFX=AudioManager.FX_KEYPRESS_RETURN;
    break;
case KeyCodes.DELETE:
  keyFX=AudioManager.FX_KEYPRESS_DELETE;
break;
case KeyCodes.SPACE:
keyFX=AudioManager.FX_KEYPRESS_SPACEBAR;
break;
default :
keyFX=AudioManager.FX_KEY_CLICK;
}
final float fxVolume;
{
final int volume;
final int maxVolume;
if (mSoundVolume > 0) {
volume=mSoundVolume;
maxVolume=100;
fxVolume=((float)volume) / ((float)maxVolume);
}
 else {
fxVolume=-1.0f;
}
}
mAudioManager.playSoundEffect(keyFX,fxVolume);
}
}

Fixed version (ground truth):
@Override public void onPress(int primaryCode){
  super.onPress(primaryCode);
  InputConnection ic=getCurrentInputConnection();
  if (mVibrationDuration > 0 && primaryCode != 0 && mVibrator != null) {
    try {
      mVibrator.vibrate(mVibrationDuration);
    }
 catch (    Exception e) {
      Logger.w(TAG,"String_Node_Str");
      mVibrationDuration=0;
    }
  }
  if (primaryCode == KeyCodes.SHIFT) {
    mShiftKeyState.onPress();
    handleShift();
  }
 else {
    mShiftKeyState.onOtherKeyPressed();
  }
  if (primaryCode == KeyCodes.CTRL) {
    mControlKeyState.onPress();
    handleControl();
    sendKeyDown(ic,113);
  }
 else {
    mControlKeyState.onOtherKeyPressed();
  }
  if (mSoundOn && (!mSilentMode) && primaryCode != 0) {
    final int keyFX;
switch (primaryCode) {
case 13:
case KeyCodes.ENTER:
      keyFX=AudioManager.FX_KEYPRESS_RETURN;
    break;
case KeyCodes.DELETE:
  keyFX=AudioManager.FX_KEYPRESS_DELETE;
break;
case KeyCodes.SPACE:
keyFX=AudioManager.FX_KEYPRESS_SPACEBAR;
break;
default :
keyFX=AudioManager.FX_KEY_CLICK;
}
final float fxVolume;
{
final int volume;
final int maxVolume;
if (mSoundVolume > 0) {
volume=mSoundVolume;
maxVolume=100;
fxVolume=((float)volume) / ((float)maxVolume);
}
 else {
fxVolume=-1.0f;
}
}
mAudioManager.playSoundEffect(keyFX,fxVolume);
}
}