nus-yam/ex-repair huggingface dataset:
Program: 157556
Project: 157556
Buggy source:
public void onClick(DialogInterface di,int position){
  di.dismiss();
switch (position) {
case 0:
    launchSettings();
  break;
case 1:
launchDictioanryOverriding();
break;
case 2:
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showInputMethodPicker();
break;
}
}

Fixed version (ground truth):
public void onClick(DialogInterface di,int position){
  di.dismiss();
switch (position) {
case 0:
    launchSettings();
  break;
case 1:
launchDictionaryOverriding();
break;
case 2:
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showInputMethodPicker();
break;
}
}
Program: 157557
Project: 157557
Buggy source:
private Dictionary getDictionaryForKeyboard(AnyKeyboard currentKeyboard){
  String mappingSettingsKey=getDictionaryOverrideKey(currentKeyboard);
  String defaultDictionary=currentKeyboard.getDefaultDictionaryLanguage();
  String dictionaryValue=getSharedPreferences().getString(mappingSettingsKey,null);
  Dictionary dictionary=null;
  if (dictionaryValue == null)   dictionary=DictionaryFactory.getDictionaryByLanguage(currentKeyboard.getDefaultDictionaryLanguage(),this);
 else {
    if (dictionaryValue != null) {
      Log.d("String_Node_Str","String_Node_Str" + (defaultDictionary == null ? "String_Node_Str" : defaultDictionary) + "String_Node_Str"+ currentKeyboard.getKeyboardPrefId()+ "String_Node_Str"+ dictionaryValue+ "String_Node_Str");
      dictionary=DictionaryFactory.getDictionaryById(dictionaryValue,this);
    }
  }
  return dictionary;
}

Fixed version (ground truth):
private Dictionary getDictionaryForKeyboard(AnyKeyboard currentKeyboard){
  String mappingSettingsKey=getDictionaryOverrideKey(currentKeyboard);
  String defaultDictionary=currentKeyboard.getDefaultDictionaryLanguage();
  String dictionaryValue=getSharedPreferences().getString(mappingSettingsKey,null);
  Dictionary dictionary=null;
  if (dictionaryValue == null) {
    dictionary=DictionaryFactory.getDictionaryByLanguage(currentKeyboard.getDefaultDictionaryLanguage(),this);
  }
 else {
    Log.d("String_Node_Str","String_Node_Str" + (defaultDictionary == null ? "String_Node_Str" : defaultDictionary) + "String_Node_Str"+ currentKeyboard.getKeyboardPrefId()+ "String_Node_Str"+ dictionaryValue+ "String_Node_Str");
    dictionary=DictionaryFactory.getDictionaryById(dictionaryValue,this);
  }
  return dictionary;
}
Program: 157558
Project: 157558
Buggy source:
private void showOptionsMenu(){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.icon_8_key);
  builder.setNegativeButton(android.R.string.cancel,null);
  CharSequence itemSettings=getString(R.string.ime_settings);
  CharSequence itemOverrideDictionary=getString(R.string.override_dictionary);
  CharSequence itemInputMethod=getString(R.string.change_ime);
  builder.setItems(new CharSequence[]{itemSettings,itemOverrideDictionary,itemInputMethod},new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface di,    int position){
      di.dismiss();
switch (position) {
case 0:
        launchSettings();
      break;
case 1:
    launchDictioanryOverriding();
  break;
case 2:
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showInputMethodPicker();
break;
}
}
}
);
builder.setTitle(getResources().getString(R.string.ime_name));
mOptionsDialog=builder.create();
Window window=mOptionsDialog.getWindow();
WindowManager.LayoutParams lp=window.getAttributes();
lp.token=mInputView.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 showOptionsMenu(){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.icon_8_key);
  builder.setNegativeButton(android.R.string.cancel,null);
  CharSequence itemSettings=getString(R.string.ime_settings);
  CharSequence itemOverrideDictionary=getString(R.string.override_dictionary);
  CharSequence itemInputMethod=getString(R.string.change_ime);
  builder.setItems(new CharSequence[]{itemSettings,itemOverrideDictionary,itemInputMethod},new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface di,    int position){
      di.dismiss();
switch (position) {
case 0:
        launchSettings();
      break;
case 1:
    launchDictionaryOverriding();
  break;
case 2:
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showInputMethodPicker();
break;
}
}
}
);
builder.setTitle(getResources().getString(R.string.ime_name));
mOptionsDialog=builder.create();
Window window=mOptionsDialog.getWindow();
WindowManager.LayoutParams lp=window.getAttributes();
lp.token=mInputView.getWindowToken();
lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
mOptionsDialog.show();
}
Program: 157559
Project: 157559
Buggy source:
public synchronized static Dictionary getDictionaryByLanguage(final String language,AnyKeyboardContextProvider context){
  return getDictionaryImpl(null,language,context);
}

Fixed version (ground truth):
public synchronized static Dictionary getDictionaryByLanguage(final String language,AnyKeyboardContextProvider context){
  return getDictionaryImpl(language,null,context);
}
Program: 157560
Project: 157560
Buggy source:
private static Dictionary locateDictionaryByIdInFactory(final String id,AnyKeyboardContextProvider context) throws Exception {
  Dictionary dict=null;
  final ArrayList<DictionaryBuilder> allBuilders=ExternalDictionaryFactory.getAllBuilders(context.getApplicationContext());
  for (  DictionaryBuilder builder : allBuilders) {
    if (AnySoftKeyboardConfiguration.getInstance().getDEBUG()) {
      Log.d("String_Node_Str",MessageFormat.format("String_Node_Str",new Object[]{builder.getId(),builder.getLanguage(),id}));
    }
    if (builder.getId().equalsIgnoreCase(id)) {
      dict=builder.createDictionary();
      break;
    }
  }
  return dict;
}

Fixed version (ground truth):
private static Dictionary locateDictionaryByIdInFactory(final String id,AnyKeyboardContextProvider context) throws Exception {
  Dictionary dict=null;
  if (id == null)   return dict;
  final ArrayList<DictionaryBuilder> allBuilders=ExternalDictionaryFactory.getAllBuilders(context.getApplicationContext());
  for (  DictionaryBuilder builder : allBuilders) {
    if (AnySoftKeyboardConfiguration.getInstance().getDEBUG()) {
      Log.d("String_Node_Str",MessageFormat.format("String_Node_Str",new Object[]{builder.getId(),builder.getLanguage(),id}));
    }
    if (builder.getId().equalsIgnoreCase(id)) {
      dict=builder.createDictionary();
      break;
    }
  }
  return dict;
}
Program: 157562
Project: 157562
Buggy source:
public synchronized static Dictionary getDictionaryById(final String id,AnyKeyboardContextProvider context){
  return getDictionaryImpl(id,null,context);
}

Fixed version (ground truth):
public synchronized static Dictionary getDictionaryById(final String id,AnyKeyboardContextProvider context){
  return getDictionaryImpl(null,id,context);
}
Program: 157563
Project: 157563
Buggy source:
private static Dictionary locateDictionaryByLanguageInFactory(final String language,AnyKeyboardContextProvider context) throws Exception {
  Dictionary dict=null;
  final ArrayList<DictionaryBuilder> allBuilders=ExternalDictionaryFactory.getAllBuilders(context.getApplicationContext());
  for (  DictionaryBuilder builder : allBuilders) {
    if (AnySoftKeyboardConfiguration.getInstance().getDEBUG()) {
      Log.d("String_Node_Str",MessageFormat.format("String_Node_Str",new Object[]{builder.getId(),builder.getLanguage(),language}));
    }
    if (builder.getLanguage().equalsIgnoreCase(language)) {
      dict=builder.createDictionary();
      break;
    }
  }
  return dict;
}

Fixed version (ground truth):
private static Dictionary locateDictionaryByLanguageInFactory(final String language,AnyKeyboardContextProvider context) throws Exception {
  Dictionary dict=null;
  if (language == null)   return dict;
  final ArrayList<DictionaryBuilder> allBuilders=ExternalDictionaryFactory.getAllBuilders(context.getApplicationContext());
  for (  DictionaryBuilder builder : allBuilders) {
    if (AnySoftKeyboardConfiguration.getInstance().getDEBUG()) {
      Log.d("String_Node_Str",MessageFormat.format("String_Node_Str",new Object[]{builder.getId(),builder.getLanguage(),language}));
    }
    if (builder.getLanguage().equalsIgnoreCase(language)) {
      dict=builder.createDictionary();
      break;
    }
  }
  return dict;
}
Program: 157564
Project: 157564
Buggy source:
public String getLanguage(){
  return null;
}

Fixed version (ground truth):
public String getLanguage(){
  return mLanguage;
}
Program: 157565
Project: 157565
Buggy source:
protected AnyKeyboard(AnyKeyboardContextProvider context,int xmlLayoutResId){
  super(context.getApplicationContext(),xmlLayoutResId);
  mDebug=AnySoftKeyboardConfiguration.getInstance().getDEBUG();
  mKeyboardContext=context;
  mOnShiftIcon=context.getApplicationContext().getResources().getDrawable(R.drawable.sym_keyboard_shift_on);
}

Fixed version (ground truth):
protected AnyKeyboard(AnyKeyboardContextProvider context,int xmlLayoutResId){
  super(context.getApplicationContext(),xmlLayoutResId);
  mDebug=AnySoftKeyboardConfiguration.getInstance().getDEBUG();
  mKeyboardContext=context;
  mOnShiftIcon=context.getApplicationContext().getResources().getDrawable(R.drawable.sym_keyboard_shift_on);
  mOffShiftIcon=context.getApplicationContext().getResources().getDrawable(R.drawable.sym_keyboard_shift);
}
Program: 157568
Project: 157568
Buggy source:
@Override public void setKeyboard(Keyboard keyboard){
  if ((keyboard != null) && (keyboard.getMinWidth() != getWidth())) {
    Log.w("String_Node_Str","String_Node_Str" + keyboard.getMinWidth() + "String_Node_Str"+ getWidth());
  }
  super.setKeyboard(keyboard);
}

Fixed version (ground truth):
@Override public void setKeyboard(Keyboard keyboard){
  if ((keyboard != null) && (keyboard.getMinWidth() != getWidth())) {
    Log.w(TAG,"String_Node_Str" + keyboard.getMinWidth() + "String_Node_Str"+ getWidth());
  }
  super.setKeyboard(keyboard);
}
Program: 157569
Project: 157569
Buggy source:
public void onPress(int primaryCode){
  if (mVibrationDuration > 0) {
    if (DEBUG)     Log.d("String_Node_Str","String_Node_Str");
    ((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(mVibrationDuration);
  }
  if (mSoundOn) {
    AudioManager manager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
    if (manager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
      int keyFX;
switch (primaryCode) {
case 13:
        keyFX=AudioManager.FX_KEYPRESS_RETURN;
case Keyboard.KEYCODE_DELETE:
      keyFX=AudioManager.FX_KEYPRESS_DELETE;
case 32:
    keyFX=AudioManager.FX_KEYPRESS_SPACEBAR;
default :
  keyFX=AudioManager.FX_KEY_CLICK;
}
final float volume=(mSoundVolume < 0) ? manager.getStreamVolume(AudioManager.STREAM_NOTIFICATION) : mSoundVolume;
if (DEBUG) Log.d("String_Node_Str","String_Node_Str" + keyFX + "String_Node_Str"+ volume);
manager.playSoundEffect(keyFX,volume);
}
 else {
if (DEBUG) Log.v("String_Node_Str","String_Node_Str");
}
}
if (primaryCode == KEYCODE_SPACE) {
if (DEBUG) Log.d("String_Node_Str","String_Node_Str" + mSwitchKeyboardOnSpace);
if (mSwitchKeyboardOnSpace && !mKeyboardSwitcher.isAlphabetMode()) {
mKeyboardSwitcher.nextKeyboard(getCurrentInputEditorInfo(),NextKeyboardType.Alphabet);
}
}
}

Fixed version (ground truth):
public void onPress(int primaryCode){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + primaryCode);
  if (mVibrationDuration > 0) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    ((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(mVibrationDuration);
  }
  if (mSoundOn) {
    AudioManager manager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
    if (manager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
      int keyFX;
switch (primaryCode) {
case 13:
        keyFX=AudioManager.FX_KEYPRESS_RETURN;
case Keyboard.KEYCODE_DELETE:
      keyFX=AudioManager.FX_KEYPRESS_DELETE;
case 32:
    keyFX=AudioManager.FX_KEYPRESS_SPACEBAR;
default :
  keyFX=AudioManager.FX_KEY_CLICK;
}
final float volume=(mSoundVolume < 0) ? manager.getStreamVolume(AudioManager.STREAM_NOTIFICATION) : mSoundVolume;
if (DEBUG) Log.d("String_Node_Str","String_Node_Str" + keyFX + "String_Node_Str"+ volume);
manager.playSoundEffect(keyFX,volume);
}
 else {
if (DEBUG) Log.v("String_Node_Str","String_Node_Str");
}
}
}
Program: 157570
Project: 157570
Buggy source:
public void onRelease(int primaryCode){
}

Fixed version (ground truth):
public void onRelease(int primaryCode){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + primaryCode);
}
Program: 157571
Project: 157571
Buggy source:
@Override public void onFinishInput(){
  if (DEBUG)   Log.d("String_Node_Str","String_Node_Str");
  super.onFinishInput();
  if (mInputView != null) {
    mInputView.closing();
  }
  if (!mKeyboardChangeNotificationType.equals(KEYBOARD_NOTIFICATION_ALWAYS)) {
    NotificationManager notificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(KEYBOARD_NOTIFICATION_ID);
  }
  resetComposing();
  System.gc();
}

Fixed version (ground truth):
@Override public void onFinishInput(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  super.onFinishInput();
  if (mInputView != null) {
    mInputView.closing();
  }
  if (!mKeyboardChangeNotificationType.equals(KEYBOARD_NOTIFICATION_ALWAYS)) {
    NotificationManager notificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(KEYBOARD_NOTIFICATION_ID);
  }
  resetComposing();
  System.gc();
}
Program: 157574
Project: 157574
Buggy source:
@Override public void onDisplayCompletions(CompletionInfo[] completions){
  if (DEBUG) {
    Log.i("String_Node_Str","String_Node_Str");
    for (int i=0; i < (completions != null ? completions.length : 0); i++) {
      Log.i("String_Node_Str","String_Node_Str" + i + "String_Node_Str"+ completions[i]);
    }
  }
  if (mCompletionOn || (isFullscreenMode() && (completions != null))) {
    if (DEBUG)     Log.v("String_Node_Str","String_Node_Str" + mCompletionOn + "String_Node_Str"+ isFullscreenMode());
    mCompletions=completions;
    if (completions == null) {
      if (DEBUG)       Log.v("String_Node_Str","String_Node_Str");
      mCandidateView.setSuggestions(null,false,false,false);
      return;
    }
    List<CharSequence> stringList=new ArrayList<CharSequence>();
    for (int i=0; i < (completions != null ? completions.length : 0); i++) {
      CompletionInfo ci=completions[i];
      if (ci != null)       stringList.add(ci.getText());
    }
    if (DEBUG)     Log.v("String_Node_Str","String_Node_Str" + stringList.size() + "String_Node_Str");
    mCandidateView.setSuggestions(stringList,true,true,true);
    mBestWord=null;
    setCandidatesViewShown(true);
  }
 else   if (DEBUG)   Log.v("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Override public void onDisplayCompletions(CompletionInfo[] completions){
  if (DEBUG) {
    Log.i(TAG,"String_Node_Str");
    for (int i=0; i < (completions != null ? completions.length : 0); i++) {
      Log.i("String_Node_Str","String_Node_Str" + i + "String_Node_Str"+ completions[i]);
    }
  }
  if (mCompletionOn || (isFullscreenMode() && (completions != null))) {
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mCompletionOn + "String_Node_Str"+ isFullscreenMode());
    mCompletions=completions;
    if (completions == null) {
      if (DEBUG)       Log.v(TAG,"String_Node_Str");
      mCandidateView.setSuggestions(null,false,false,false);
      return;
    }
    List<CharSequence> stringList=new ArrayList<CharSequence>();
    for (int i=0; i < (completions != null ? completions.length : 0); i++) {
      CompletionInfo ci=completions[i];
      if (ci != null)       stringList.add(ci.getText());
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + stringList.size() + "String_Node_Str");
    mCandidateView.setSuggestions(stringList,true,true,true);
    mBestWord=null;
    setCandidatesViewShown(true);
  }
 else   if (DEBUG)   Log.v(TAG,"String_Node_Str");
}
Program: 157575
Project: 157575
Buggy source:
@Override public void onStartInputView(EditorInfo attribute,boolean restarting){
  if (DEBUG)   Log.d("String_Node_Str","String_Node_Str" + attribute.imeOptions + "String_Node_Str"+ attribute.inputType+ "String_Node_Str"+ restarting+ "String_Node_Str");
  super.onStartInputView(attribute,restarting);
  if (mInputView != null) {
    mInputView.closing();
    if (AutoText.getSize(mInputView) < 1)     mQuickFixes=true;
  }
}

Fixed version (ground truth):
@Override public void onStartInputView(EditorInfo attribute,boolean restarting){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + attribute.imeOptions + "String_Node_Str"+ attribute.inputType+ "String_Node_Str"+ restarting+ "String_Node_Str");
  super.onStartInputView(attribute,restarting);
  if (mInputView != null) {
    mInputView.closing();
    if (AutoText.getSize(mInputView) < 1)     mQuickFixes=true;
  }
}
Program: 157576
Project: 157576
Buggy source:
@Override public void onDestroy(){
  DictionaryFactory.close();
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  sp.unregisterOnSharedPreferenceChangeListener(this);
  if (mSoundOn) {
    Log.i("String_Node_Str","String_Node_Str");
    mAudioManager.unloadSoundEffects();
  }
  mNotificationManager.cancel(KEYBOARD_NOTIFICATION_ID);
  super.onDestroy();
}

Fixed version (ground truth):
@Override public void onDestroy(){
  DictionaryFactory.close();
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  sp.unregisterOnSharedPreferenceChangeListener(this);
  if (mSoundOn) {
    Log.i(TAG,"String_Node_Str");
    mAudioManager.unloadSoundEffects();
  }
  mNotificationManager.cancel(KEYBOARD_NOTIFICATION_ID);
  super.onDestroy();
}
Program: 157577
Project: 157577
Buggy source:
@Override public void onFinishInputView(boolean finishingInput){
  if (DEBUG)   Log.d("String_Node_Str","String_Node_Str" + finishingInput + "String_Node_Str");
  super.onFinishInputView(finishingInput);
  if (!mKeyboardChangeNotificationType.equals(KEYBOARD_NOTIFICATION_ALWAYS)) {
    mNotificationManager.cancel(KEYBOARD_NOTIFICATION_ID);
  }
  if (finishingInput)   resetComposing();
}

Fixed version (ground truth):
@Override public void onFinishInputView(boolean finishingInput){
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + finishingInput + "String_Node_Str");
  super.onFinishInputView(finishingInput);
  if (!mKeyboardChangeNotificationType.equals(KEYBOARD_NOTIFICATION_ALWAYS)) {
    mNotificationManager.cancel(KEYBOARD_NOTIFICATION_ID);
  }
  if (finishingInput)   resetComposing();
}
Program: 157581
Project: 157581
Buggy source:
public Dictionary createDictionary(AnyKeyboardContextProvider context) throws Exception {
  return new BinaryDictionary(context.getApplicationContext().getAssets().openFd(mAssetsFilename));
}

Fixed version (ground truth):
public Dictionary createDictionary() throws Exception {
  return new BinaryDictionary(mPackageContext.getAssets().openFd(mAssetsFilename));
}
Program: 157582
Project: 157582
Buggy source:
public BinaryDictionaryBuilderImpl(Context context,String key,int nameId,String assetsFilename,String description){
  mKey=key;
  mNameId=nameId;
  mDescription=description;
  mAssetsFilename=assetsFilename;
  Log.d("String_Node_Str","String_Node_Str" + mKey + "String_Node_Str"+ mAssetsFilename);
}

Fixed version (ground truth):
public BinaryDictionaryBuilderImpl(Context context,String key,int nameId,String assetsFilename,String description){
  mKey=key;
  mNameId=nameId;
  mDescription=description;
  mAssetsFilename=assetsFilename;
  mPackageContext=context;
  Log.d("String_Node_Str","String_Node_Str" + mKey + "String_Node_Str"+ mAssetsFilename+ "String_Node_Str"+ mPackageContext.getPackageName());
}
Program: 157583
Project: 157583
Buggy source:
private void initializeStuff(){
  setPreviewEnabled(AnySoftKeyboardConfigurationImpl.getInstance().getShowKeyPreview());
  setProximityCorrectionEnabled(true);
}

Fixed version (ground truth):
private void initializeStuff(){
  setPreviewEnabled(AnySoftKeyboardConfiguration.getInstance().getShowKeyPreview());
  setProximityCorrectionEnabled(true);
}
Program: 157585
Project: 157585
Buggy source:
@Override public boolean onEvaluateFullscreenMode(){
  if (AnySoftKeyboardConfigurationImpl.getInstance().getUseFullScreenInput())   return super.onEvaluateFullscreenMode();
 else   return false;
}

Fixed version (ground truth):
@Override public boolean onEvaluateFullscreenMode(){
  if (AnySoftKeyboardConfiguration.getInstance().getUseFullScreenInput())   return super.onEvaluateFullscreenMode();
 else   return false;
}
Program: 157587
Project: 157587
Buggy source:
public AnySoftKeyboard(){
  mConfig=(AnySoftKeyboardConfigurationImpl)AnySoftKeyboardConfigurationImpl.getInstance();
  mHardKeyboardAction=new HardKeyboardActionImpl();
}

Fixed version (ground truth):
public AnySoftKeyboard(){
  mConfig=AnySoftKeyboardConfiguration.getInstance();
  mHardKeyboardAction=new HardKeyboardActionImpl();
}
Program: 157588
Project: 157588
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  Log.i("String_Node_Str","String_Node_Str");
  ((AnySoftKeyboardConfigurationImpl)mConfig).initializeConfiguration(this);
  DEBUG=mConfig.getDEBUG();
  mNotificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  mAudioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  loadSettings();
  mKeyboardSwitcher=new KeyboardSwitcher(this);
  if (mSuggest == null) {
    if (mKeyboardChangeNotificationType.equals(KEYBOARD_NOTIFICATION_ALWAYS))     notifyKeyboardChangeIfNeeded();
    initSuggest();
  }
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  sp.registerOnSharedPreferenceChangeListener(this);
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  Log.i("String_Node_Str","String_Node_Str");
  ((AnySoftKeyboardConfiguration.AnySoftKeyboardConfigurationImpl)mConfig).initializeConfiguration(this);
  DEBUG=mConfig.getDEBUG();
  mNotificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  mAudioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  loadSettings();
  mKeyboardSwitcher=new KeyboardSwitcher(this);
  if (mSuggest == null) {
    if (mKeyboardChangeNotificationType.equals(KEYBOARD_NOTIFICATION_ALWAYS))     notifyKeyboardChangeIfNeeded();
    initSuggest();
  }
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  sp.registerOnSharedPreferenceChangeListener(this);
}
Program: 157589
Project: 157589
Buggy source:
boolean getShowKeyPreview();

Fixed version (ground truth):
public boolean getShowKeyPreview(){
  return mShowKeyPreview;
}
Program: 157590
Project: 157590
Buggy source:
boolean getDEBUG();

Fixed version (ground truth):
public boolean getDEBUG(){
  return mDEBUG;
}
Program: 157591
Project: 157591
Buggy source:
String getChangeLayoutKeysSize();

Fixed version (ground truth):
public String getChangeLayoutKeysSize(){
  return mLayoutChangeKeysSize;
}
Program: 157592
Project: 157592
Buggy source:
boolean getUseFullScreenInput();

Fixed version (ground truth):
public boolean getUseFullScreenInput(){
  return mUseFullScreenInput;
}
Program: 157593
Project: 157593
Buggy source:
String getDomainText();

Fixed version (ground truth):
public String getDomainText(){
  return mDomainText;
}
Program: 157594
Project: 157594
Buggy source:
String getSmileyText();

Fixed version (ground truth):
public String getSmileyText(){
  return mSmileyText;
}
Program: 157595
Project: 157595
Buggy source:
boolean getSwitchKeyboardOnSpace();

Fixed version (ground truth):
public boolean getSwitchKeyboardOnSpace(){
  return mSwitchKeyboardOnSpace;
}
Program: 157596
Project: 157596
Buggy source:
public static KeyboardCreator[] createAlphaBetKeyboards(AnyKeyboardContextProvider contextProvider){
  Log.i("String_Node_Str","String_Node_Str" + ms_creators.size() + "String_Node_Str");
  ArrayList<KeyboardCreator> keyboards=new ArrayList<KeyboardCreator>();
  SharedPreferences sharedPreferences=contextProvider.getSharedPreferences();
  for (int keyboardIndex=0; keyboardIndex < ms_creators.size(); keyboardIndex++) {
    KeyboardCreator creator=ms_creators.get(keyboardIndex);
    boolean keyboardIsEnabled=sharedPreferences.getBoolean(creator.getKeyboardPrefId(),keyboardIndex == 0);
    if (keyboardIsEnabled) {
      keyboards.add(creator);
    }
  }
  for (  KeyboardCreator aKeyboard : keyboards)   Log.d("String_Node_Str","String_Node_Str" + aKeyboard.getKeyboardPrefId());
  keyboards.trimToSize();
  KeyboardCreator[] keyboardsArray=new KeyboardCreator[keyboards.size()];
  return keyboards.toArray(keyboardsArray);
}

Fixed version (ground truth):
public static KeyboardCreator[] createAlphaBetKeyboards(AnyKeyboardContextProvider contextProvider){
  Log.i("String_Node_Str","String_Node_Str" + ms_creators.size() + "String_Node_Str");
  ArrayList<KeyboardCreator> keyboards=new ArrayList<KeyboardCreator>();
  SharedPreferences sharedPreferences=contextProvider.getSharedPreferences();
  for (int keyboardIndex=0; keyboardIndex < ms_creators.size(); keyboardIndex++) {
    KeyboardCreator creator=ms_creators.get(keyboardIndex);
    boolean keyboardIsEnabled=sharedPreferences.getBoolean(creator.getKeyboardPrefId(),keyboardIndex == 0);
    if (keyboardIsEnabled) {
      keyboards.add(creator);
    }
  }
  if (keyboards.size() == 0) {
    SharedPreferences.Editor editor=sharedPreferences.edit();
    KeyboardCreator creator=ms_creators.get(0);
    editor.putBoolean(creator.getKeyboardPrefId(),true);
    editor.commit();
    keyboards.add(creator);
  }
  for (  KeyboardCreator aKeyboard : keyboards)   Log.d("String_Node_Str","String_Node_Str" + aKeyboard.getKeyboardPrefId());
  keyboards.trimToSize();
  KeyboardCreator[] keyboardsArray=new KeyboardCreator[keyboards.size()];
  return keyboards.toArray(keyboardsArray);
}
Program: 157598
Project: 157598
Buggy source:
void setKeyboardMode(int mode,EditorInfo attr){
  mImeOptions=(attr == null) ? 0 : attr.imeOptions;
  AnyKeyboard keyboard=(AnyKeyboard)mInputView.getKeyboard();
  mInputView.setPreviewEnabled(true);
switch (mode) {
case MODE_TEXT:
case MODE_URL:
case MODE_EMAIL:
case MODE_IM:
    keyboard=getAlphabetKeyboard(mLastSelectedKeyboard);
  if (keyboard == null)   mAlphabetMode=true;
break;
case MODE_SYMBOLS:
case MODE_PHONE:
keyboard=(mode == MODE_PHONE) ? getSymbolsKeyboard(SYMBOLS_KEYBOARD_PHONE_INDEX) : getSymbolsKeyboard(0);
mAlphabetMode=true;
break;
}
if (mInputView != null) mInputView.setKeyboard(keyboard);
keyboard.setShifted(mInputView.isShifted());
keyboard.setShiftLocked(keyboard.isShiftLocked());
keyboard.setImeOptions(mContext.getResources(),(attr == null) ? 0 : attr.imeOptions);
keyboard.setTextVariation(mContext.getResources(),(attr == null) ? 0 : attr.inputType);
}

Fixed version (ground truth):
void setKeyboardMode(int mode,EditorInfo attr){
  mImeOptions=(attr == null) ? 0 : attr.imeOptions;
  AnyKeyboard keyboard=null;
  mInputView.setPreviewEnabled(true);
switch (mode) {
case MODE_SYMBOLS:
case MODE_PHONE:
    keyboard=(mode == MODE_PHONE) ? getSymbolsKeyboard(SYMBOLS_KEYBOARD_PHONE_INDEX) : getSymbolsKeyboard(0);
  mAlphabetMode=false;
break;
default :
keyboard=getAlphabetKeyboard(mLastSelectedKeyboard);
mAlphabetMode=true;
break;
}
if (mInputView != null) mInputView.setKeyboard(keyboard);
keyboard.setShifted(mInputView.isShifted());
keyboard.setShiftLocked(keyboard.isShiftLocked());
keyboard.setImeOptions(mContext.getResources(),(attr == null) ? 0 : attr.imeOptions);
keyboard.setTextVariation(mContext.getResources(),(attr == null) ? 0 : attr.inputType);
}
Program: 157599
Project: 157599
Buggy source:
public char getSequenceCharacter(int currentKeyEvent,AnyKeyboardContextProvider inputHandler){
  long currentTime=System.currentTimeMillis();
  if ((currentTime - mLastTypedKeyEventTime) >= msSequenceLivingTime)   mCurrentTypedSequence.reset();
  mLastTypedKeyEventTime=currentTime;
  mCurrentTypedSequence.appendKeyEvent(currentKeyEvent);
  if (mSequences.containsKey(mCurrentTypedSequence)) {
    KeyEventSequence mappedSequence=mSequences.get(mCurrentTypedSequence);
    char mappedChar=mappedSequence.getTarget();
    if (mappedChar == 0)     return 0;
 else {
      inputHandler.deleteLastCharactersFromInput(mappedSequence.getSequenceLength() - 1);
      return mappedChar;
    }
  }
 else {
    int lastSequenceLength=mCurrentTypedSequence.getSequenceLength();
    mCurrentTypedSequence.reset();
    if (lastSequenceLength > 1) {
      return getSequenceCharacter(currentKeyEvent,inputHandler);
    }
    return 0;
  }
}

Fixed version (ground truth):
public char getSequenceCharacter(int currentKeyEvent,AnyKeyboardContextProvider inputHandler){
  long currentTime=System.currentTimeMillis();
  if ((currentTime - mLastTypedKeyEventTime) >= msSequenceLivingTime)   mCurrentTypedSequence.reset();
  mLastTypedKeyEventTime=currentTime;
  mCurrentTypedSequence.appendKeyEvent(currentKeyEvent);
  if (mSequences.containsKey(mCurrentTypedSequence)) {
    KeyEventSequence mappedSequence=mSequences.get(mCurrentTypedSequence);
    char mappedChar=mappedSequence.getTarget();
    if (mappedChar == 0)     return 0;
 else {
      final int charactersToDelete=mappedSequence.getSequenceLength() - 1;
      inputHandler.deleteLastCharactersFromInput(charactersToDelete - mCurrentTypedSequence.getDeletedCharactersCountTillNow());
      mCurrentTypedSequence.setDeletedCharactersCountAtInput(charactersToDelete);
      return mappedChar;
    }
  }
 else {
    int lastSequenceLength=mCurrentTypedSequence.getSequenceLength();
    mCurrentTypedSequence.reset();
    if (lastSequenceLength > 1) {
      return getSequenceCharacter(currentKeyEvent,inputHandler);
    }
    return 0;
  }
}
Program: 157600
Project: 157600
Buggy source:
public void reset(){
  mCurrentSequenceLength=0;
  mHashCode=0;
}

Fixed version (ground truth):
public void reset(){
  mCurrentSequenceLength=0;
  mHashCode=0;
  mDeletedCharactersTillNow=0;
}
Program: 157601
Project: 157601
Buggy source:
public void addSequence(int[] sequence,char result){
  for (int sequenceLength=1; sequenceLength < sequence.length; sequenceLength++) {
    int[] subSequence=new int[sequenceLength];
    for (int i=0; i < sequenceLength; i++)     subSequence[i]=sequence[i];
    KeyEventSequence keysSequence=new KeyEventSequence(subSequence,(char)0);
    if (!mSequences.containsKey(keysSequence))     mSequences.put(keysSequence,keysSequence);
  }
  KeyEventSequence actualSequence=new KeyEventSequence(sequence,result);
  mSequences.put(actualSequence,actualSequence);
}

Fixed version (ground truth):
public void addSequence(int[] sequence,char result){
  for (int sequenceLength=1; sequenceLength < sequence.length; sequenceLength++) {
    int[] subSequence=new int[sequenceLength];
    for (int i=0; i < sequenceLength; i++)     subSequence[i]=sequence[i];
    KeyEventSequence keysSequence=new KeyEventSequence(subSequence,(char)0);
    if (!mSequences.containsKey(keysSequence))     mSequences.put(keysSequence,keysSequence);
  }
  KeyEventSequence actualSequence=new KeyEventSequence(sequence,result);
  if (mSequences.containsKey(actualSequence)) {
    mSequences.remove(actualSequence);
  }
  mSequences.put(actualSequence,actualSequence);
}
Program: 157602
Project: 157602
Buggy source:
public EnglishKeyboard(AnyKeyboardContextProvider context,int keyboardLayoutId,int keyboardNameId){
  super(context,keyboardLayoutId,keyboardNameId,Dictionary.Language.English);
}

Fixed version (ground truth):
public EnglishKeyboard(AnyKeyboardContextProvider context){
  super(context,KeyboardFactory.ENGLISH_KEYBOARD,R.xml.qwerty,R.string.eng_keyboard,Dictionary.Language.English);
}
Program: 157603
Project: 157603
Buggy source:
public AnyKeyboard createKeyboard(AnyKeyboardContextProvider contextProvider){
  return new LatinKeyboard(contextProvider,R.xml.de_qwerty,R.string.de_keyboard,Dictionary.Language.German);
}

Fixed version (ground truth):
public AnyKeyboard createKeyboard(AnyKeyboardContextProvider contextProvider){
  return new LatinKeyboard(contextProvider,KeyboardFactory.DE_KEYBOARD,R.xml.de_qwerty,R.string.de_keyboard,Dictionary.Language.German);
}
Program: 157605
Project: 157605
Buggy source:
public boolean initializeAction(KeyEvent event){
  mChanegd=false;
  mKeyCode=event.getKeyCode();
switch (mKeyCode) {
case KeyEvent.KEYCODE_SHIFT_LEFT:
case KeyEvent.KEYCODE_SHIFT_RIGHT:
    if (event.getRepeatCount() == 0) {
      mPhysicalShiftState=getNextState(mPhysicalShiftState,event.isShiftPressed());
      if (DEBUG)       Log.d("String_Node_Str","String_Node_Str" + mPhysicalShiftState);
    }
  return true;
case KeyEvent.KEYCODE_ALT_LEFT:
case KeyEvent.KEYCODE_ALT_RIGHT:
if (event.getRepeatCount() == 0) {
  mPhysicalAltState=getNextState(mPhysicalAltState,event.isAltPressed());
  if (DEBUG)   Log.d("String_Node_Str","String_Node_Str" + mPhysicalAltState);
}
return true;
default :
if (((event.getMetaState() & KeyEvent.META_SHIFT_ON) == 0) && (mPhysicalShiftState == MetaKeyState.On)) mPhysicalShiftState=MetaKeyState.Off;
if (((event.getMetaState() & KeyEvent.META_ALT_ON) == 0) && (mPhysicalAltState == MetaKeyState.On)) mPhysicalAltState=MetaKeyState.Off;
return false;
}
}

Fixed version (ground truth):
public boolean initializeAction(KeyEvent event){
  mChanegd=false;
  mKeyCode=event.getKeyCode();
switch (mKeyCode) {
case KeyEvent.KEYCODE_SHIFT_LEFT:
case KeyEvent.KEYCODE_SHIFT_RIGHT:
    if (event.getRepeatCount() == 0) {
      mPhysicalShiftState=getNextStateOnMetaKeyPress(mPhysicalShiftState,event.isShiftPressed());
      if (DEBUG)       Log.d("String_Node_Str","String_Node_Str" + mPhysicalShiftState);
    }
  return true;
case KeyEvent.KEYCODE_ALT_LEFT:
case KeyEvent.KEYCODE_ALT_RIGHT:
if (event.getRepeatCount() == 0) {
  mPhysicalAltState=getNextStateOnMetaKeyPress(mPhysicalAltState,event.isAltPressed());
  if (DEBUG)   Log.d("String_Node_Str","String_Node_Str" + mPhysicalAltState);
}
return true;
default :
mPhysicalShiftState=getNextStateOnRegularKey(mPhysicalShiftState,event.isShiftPressed());
mPhysicalAltState=getNextStateOnRegularKey(mPhysicalAltState,event.isAltPressed());
return false;
}
}
Program: 157606
Project: 157606
Buggy source:
@Override protected Key createKeyFromXml(Resources res,Row parent,int x,int y,XmlResourceParser parser){
  Key key=super.createKeyFromXml(res,parent,x,y,parser);
  if (key.codes[0] == 10) {
    mEnterKey=key;
  }
 else   if ((key.codes[0] == Keyboard.KEYCODE_MODE_CHANGE) || (key.codes[0] == AnyKeyboard.KEYCODE_LANG_CHANGE)) {
    if (SoftKeyboard.mChangeKeysMode.equals("String_Node_Str")) {
      key.label="String_Node_Str";
      key.height=0;
      key.width=0;
    }
  }
 else {
    if (isAlphabetKey(key)) {
      key.label="String_Node_Str" + ((char)key.codes[0]);
    }
  }
  Log.v("String_Node_Str","String_Node_Str" + key.codes[0] + "String_Node_Str"+ key.width+ "String_Node_Str"+ key.height+ "String_Node_Str"+ key.label+ "String_Node_Str");
  return key;
}

Fixed version (ground truth):
@Override protected Key createKeyFromXml(Resources res,Row parent,int x,int y,XmlResourceParser parser){
  Key key=super.createKeyFromXml(res,parent,x,y,parser);
  if (key.codes[0] == 10) {
    mEnterKey=key;
  }
 else   if ((key.codes[0] == Keyboard.KEYCODE_MODE_CHANGE) || (key.codes[0] == AnyKeyboard.KEYCODE_LANG_CHANGE)) {
    if (SoftKeyboard.mChangeKeysMode.equals("String_Node_Str")) {
      key.label=null;
      key.height=0;
      key.width=0;
    }
  }
 else {
    if (isAlphabetKey(key)) {
      key.label="String_Node_Str" + ((char)key.codes[0]);
    }
  }
  Log.v("String_Node_Str","String_Node_Str" + key.codes[0] + "String_Node_Str"+ key.width+ "String_Node_Str"+ key.height+ "String_Node_Str"+ key.label+ "String_Node_Str");
  return key;
}
Program: 157607
Project: 157607
Buggy source:
public void onPress(int primaryCode){
  if (mVibrateOnKeyPress) {
    ((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(12);
  }
  if (mSoundOnKeyPress) {
    int keyFX=AudioManager.FX_KEY_CLICK;
switch (primaryCode) {
case 13:
      keyFX=AudioManager.FX_KEYPRESS_RETURN;
case Keyboard.KEYCODE_DELETE:
    keyFX=AudioManager.FX_KEYPRESS_DELETE;
case 32:
  keyFX=AudioManager.FX_KEYPRESS_SPACEBAR;
}
((AudioManager)getSystemService(Context.AUDIO_SERVICE)).playSoundEffect(keyFX);
}
}

Fixed version (ground truth):
public void onPress(int primaryCode){
  if (mVibrateOnKeyPress) {
    Log.d("String_Node_Str","String_Node_Str");
    ((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(12);
  }
  if (mSoundOnKeyPress) {
    AudioManager manager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
    if (manager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
      int keyFX=AudioManager.FX_KEY_CLICK;
switch (primaryCode) {
case 13:
        keyFX=AudioManager.FX_KEYPRESS_RETURN;
case Keyboard.KEYCODE_DELETE:
      keyFX=AudioManager.FX_KEYPRESS_DELETE;
case 32:
    keyFX=AudioManager.FX_KEYPRESS_SPACEBAR;
}
int volume=manager.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
Log.d("String_Node_Str","String_Node_Str" + keyFX + "String_Node_Str"+ volume);
manager.playSoundEffect(keyFX,volume);
}
 else {
Log.d("String_Node_Str","String_Node_Str");
}
}
}
Program: 157608
Project: 157608
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  sp.unregisterOnSharedPreferenceChangeListener(this);
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  sp.unregisterOnSharedPreferenceChangeListener(this);
  if (mSoundOnKeyPress) {
    Log.i("String_Node_Str","String_Node_Str");
    ((AudioManager)getSystemService(Context.AUDIO_SERVICE)).unloadSoundEffects();
  }
}
Program: 157609
Project: 157609
Buggy source:
private void reloadConfiguration(){
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  mVibrateOnKeyPress=sp.getBoolean("String_Node_Str",false);
  mSoundOnKeyPress=sp.getBoolean("String_Node_Str",false);
  mKeyboardChangeNotification=sp.getBoolean("String_Node_Str",true);
  if (mSoundOnKeyPress)   ((AudioManager)getSystemService(Context.AUDIO_SERVICE)).loadSoundEffects();
  mAutoCaps=sp.getBoolean("String_Node_Str",true);
  mShowCandidates=sp.getBoolean("String_Node_Str",true);
  mChangeKeysMode=sp.getString("String_Node_Str","String_Node_Str");
  Log.d("String_Node_Str","String_Node_Str" + "String_Node_Str" + mVibrateOnKeyPress + "String_Node_Str"+ mSoundOnKeyPress+ "String_Node_Str"+ mKeyboardChangeNotification+ "String_Node_Str"+ mAutoCaps+ "String_Node_Str"+ mShowCandidates+ "String_Node_Str"+ mChangeKeysMode);
}

Fixed version (ground truth):
private void reloadConfiguration(){
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  mVibrateOnKeyPress=sp.getBoolean("String_Node_Str",false);
  mSoundOnKeyPress=sp.getBoolean("String_Node_Str",false);
  mKeyboardChangeNotification=sp.getBoolean("String_Node_Str",true);
  if (mSoundOnKeyPress) {
    Log.i("String_Node_Str","String_Node_Str");
    ((AudioManager)getSystemService(Context.AUDIO_SERVICE)).loadSoundEffects();
  }
  mAutoCaps=sp.getBoolean("String_Node_Str",true);
  mShowCandidates=sp.getBoolean("String_Node_Str",true);
  mChangeKeysMode=sp.getString("String_Node_Str","String_Node_Str");
  Log.d("String_Node_Str","String_Node_Str" + "String_Node_Str" + mVibrateOnKeyPress + "String_Node_Str"+ mSoundOnKeyPress+ "String_Node_Str"+ mKeyboardChangeNotification+ "String_Node_Str"+ mAutoCaps+ "String_Node_Str"+ mShowCandidates+ "String_Node_Str"+ mChangeKeysMode);
}
Program: 157610
Project: 157610
Buggy source:
/** 
 * This is called when the user is done editing a field.  We can use this to reset our state.
 */
@Override public void onFinishInput(){
  super.onFinishInput();
  Log.i("String_Node_Str","String_Node_Str");
  mComposing.setLength(0);
  updateCandidates();
  setCandidatesViewShown(false);
  mCurKeyboard=mKeyboards[mLastSelectedKeyboard];
  if (mInputView != null) {
    mInputView.closing();
  }
  if (mSoundOnKeyPress)   ((AudioManager)getSystemService(Context.AUDIO_SERVICE)).unloadSoundEffects();
  NotificationManager notificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  notificationManager.cancel(KEYBOARD_NOTIFICATION_ID);
}

Fixed version (ground truth):
/** 
 * This is called when the user is done editing a field.  We can use this to reset our state.
 */
@Override public void onFinishInput(){
  super.onFinishInput();
  Log.i("String_Node_Str","String_Node_Str");
  mComposing.setLength(0);
  updateCandidates();
  setCandidatesViewShown(false);
  mCurKeyboard=mKeyboards[mLastSelectedKeyboard];
  if (mInputView != null) {
    mInputView.closing();
  }
  NotificationManager notificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  notificationManager.cancel(KEYBOARD_NOTIFICATION_ID);
}
Program: 157611
Project: 157611
Buggy source:
@Override public boolean addCounters(Counter counter,Ability source,Game game,List<UUID> appliedEffects,boolean isEffect){
  boolean returnCode=true;
  UUID sourceId=(source == null ? getId() : source.getSourceId());
  GameEvent countersEvent=GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS,objectId,sourceId,getControllerOrOwner(),counter.getName(),counter.getCount());
  countersEvent.setAppliedEffects(appliedEffects);
  countersEvent.setFlag(isEffect);
  if (!game.replaceEvent(countersEvent)) {
    int amount=countersEvent.getAmount();
    int finalAmount=amount;
    for (int i=0; i < amount; i++) {
      Counter eventCounter=counter.copy();
      eventCounter.remove(eventCounter.getCount() - 1);
      GameEvent event=GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER,objectId,sourceId,getControllerOrOwner(),counter.getName(),1);
      event.setAppliedEffects(appliedEffects);
      if (!game.replaceEvent(event)) {
        getCounters(game).addCounter(eventCounter);
        game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED,objectId,sourceId,getControllerOrOwner(),counter.getName(),1));
      }
 else {
        finalAmount--;
        returnCode=false;
      }
    }
    if (finalAmount > 0) {
      game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED,objectId,sourceId,getControllerOrOwner(),counter.getName(),amount));
    }
  }
 else {
    returnCode=false;
  }
  return returnCode;
}

Fixed version (ground truth):
@Override public boolean addCounters(Counter counter,Ability source,Game game,List<UUID> appliedEffects,boolean isEffect){
  boolean returnCode=true;
  UUID sourceId=getId();
  if (source != null) {
    MageObject object=game.getObject(source.getId());
    if (object instanceof StackObject) {
      sourceId=source.getId();
    }
 else {
      sourceId=source.getSourceId();
    }
  }
  GameEvent countersEvent=GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS,objectId,sourceId,getControllerOrOwner(),counter.getName(),counter.getCount());
  countersEvent.setAppliedEffects(appliedEffects);
  countersEvent.setFlag(isEffect);
  if (!game.replaceEvent(countersEvent)) {
    int amount=countersEvent.getAmount();
    int finalAmount=amount;
    for (int i=0; i < amount; i++) {
      Counter eventCounter=counter.copy();
      eventCounter.remove(eventCounter.getCount() - 1);
      GameEvent event=GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER,objectId,sourceId,getControllerOrOwner(),counter.getName(),1);
      event.setAppliedEffects(appliedEffects);
      if (!game.replaceEvent(event)) {
        getCounters(game).addCounter(eventCounter);
        game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED,objectId,sourceId,getControllerOrOwner(),counter.getName(),1));
      }
 else {
        finalAmount--;
        returnCode=false;
      }
    }
    if (finalAmount > 0) {
      game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED,objectId,sourceId,getControllerOrOwner(),counter.getName(),amount));
    }
  }
 else {
    returnCode=false;
  }
  return returnCode;
}
Program: 157612
Project: 157612
Buggy source:
@Override public AdaptiveAutomatonAddSubtypeEffect copy(){
  return new AdaptiveAutomatonAddSubtypeEffect(this);
}

Fixed version (ground truth):
@Override public AdaptiveAutomaton copy(){
  return new AdaptiveAutomaton(this);
}
Program: 157613
Project: 157613
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanentEntering(source.getSourceId());
  SubType subtype=(SubType)game.getState().getValue(source.getSourceId() + "String_Node_Str");
  if (permanent != null && subtype != null) {
    MageObject mageObject=permanent.getBasicMageObject(game);
    if (!mageObject.getSubtype(null).contains(subtype)) {
      mageObject.getSubtype(null).add(subtype);
    }
    if (!permanent.getSubtype(null).contains(subtype)) {
      permanent.getSubtype(null).add(subtype);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanentEntering(source.getSourceId());
  SubType subtype=(SubType)game.getState().getValue(source.getSourceId() + "String_Node_Str");
  if (permanent != null && subtype != null) {
    if (!permanent.getSubtype(game).contains(subtype)) {
      permanent.getSubtype(game).add(subtype);
    }
    return true;
  }
  return false;
}
Program: 157614
Project: 157614
Buggy source:
@Override public boolean apply(Game game,Ability source){
  FilterCard filter=new FilterCard("String_Node_Str");
  filter.add(new ChosenSubtypePredicate(source.getSourceId()));
  return new RevealLibraryPutIntoHandEffect(4,filter,Zone.LIBRARY).apply(game,source);
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  FilterCard filter=new FilterCard("String_Node_Str");
  filter.add(new ChosenSubtypePredicate());
  return new RevealLibraryPutIntoHandEffect(4,filter,Zone.LIBRARY).apply(game,source);
}
Program: 157615
Project: 157615
Buggy source:
@Override public void adjustCosts(Ability ability,Game game){
  MageObject mageObject=game.getObject(ability.getSourceId());
  Effect effect=new ChooseCreatureTypeEffect(Outcome.Benefit);
  if (mageObject != null && effect.apply(game,ability)) {
    FilterPermanent filter=new FilterPermanent();
    filter.add(new ChosenSubtypePredicate(mageObject.getId()));
    ContinuousEffect effectPower=new SetPowerSourceEffect(new PermanentsOnBattlefieldCount(filter),Duration.Custom);
    ContinuousEffect effectToughness=new SetToughnessSourceEffect(new PermanentsOnBattlefieldCount(filter),Duration.Custom);
    game.addEffect(effectPower,ability);
    game.addEffect(effectToughness,ability);
  }
}

Fixed version (ground truth):
@Override public void adjustCosts(Ability ability,Game game){
  MageObject mageObject=game.getObject(ability.getSourceId());
  Effect effect=new ChooseCreatureTypeEffect(Outcome.Benefit);
  if (mageObject != null && effect.apply(game,ability)) {
    FilterPermanent filter=new FilterPermanent();
    filter.add(new ChosenSubtypePredicate());
    ContinuousEffect effectPower=new SetPowerSourceEffect(new PermanentsOnBattlefieldCount(filter),Duration.Custom);
    ContinuousEffect effectToughness=new SetToughnessSourceEffect(new PermanentsOnBattlefieldCount(filter),Duration.Custom);
    game.addEffect(effectPower,ability);
    game.addEffect(effectToughness,ability);
  }
}