nus-yam/ex-repair huggingface dataset:
Program: 24989
Project: 24989
Buggy source:
public static void saveAppSettings(Context context){
  if (apps == null)   return;
  final SharedPreferences prefs=context.getSharedPreferences(PREFS_KEY,0);
  StringBuilder tordApps=new StringBuilder();
  for (int i=0; i < apps.length; i++) {
    if (apps[i].isTorified()) {
      tordApps.append(apps[i].getUsername());
      tordApps.append("String_Node_Str");
    }
  }
  Editor edit=prefs.edit();
  edit.putString(PREFS_KEY_TORIFIED,tordApps.toString());
  edit.commit();
}

Fixed version (ground truth):
public void saveAppSettings(Context context){
  if (apps == null)   return;
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  StringBuilder tordApps=new StringBuilder();
  for (int i=0; i < apps.length; i++) {
    if (apps[i].isTorified()) {
      tordApps.append(apps[i].getUsername());
      tordApps.append("String_Node_Str");
    }
  }
  Editor edit=prefs.edit();
  edit.putString(PREFS_KEY_TORIFIED,tordApps.toString());
  edit.commit();
}
Program: 24990
Project: 24990
Buggy source:
public static TorifiedApp[] getApps(Context context){
  if (apps != null)   return apps;
  final SharedPreferences prefs=context.getSharedPreferences(PREFS_KEY,0);
  String tordAppString=prefs.getString(PREFS_KEY_TORIFIED,"String_Node_Str");
  String[] tordApps;
  StringTokenizer st=new StringTokenizer(tordAppString,"String_Node_Str");
  tordApps=new String[st.countTokens()];
  int tordIdx=0;
  while (st.hasMoreTokens()) {
    tordApps[tordIdx++]=st.nextToken();
  }
  Arrays.sort(tordApps);
  PackageManager pMgr=context.getPackageManager();
  List<ApplicationInfo> lAppInfo=pMgr.getInstalledApplications(0);
  Iterator<ApplicationInfo> itAppInfo=lAppInfo.iterator();
  apps=new TorifiedApp[lAppInfo.size()];
  ApplicationInfo aInfo=null;
  int appIdx=0;
  while (itAppInfo.hasNext()) {
    aInfo=itAppInfo.next();
    apps[appIdx]=new TorifiedApp();
    apps[appIdx].setEnabled(aInfo.enabled);
    apps[appIdx].setUid(aInfo.uid);
    apps[appIdx].setUsername(pMgr.getNameForUid(apps[appIdx].getUid()));
    apps[appIdx].setProcname(aInfo.processName);
    apps[appIdx].setName(pMgr.getApplicationLabel(aInfo).toString());
    apps[appIdx].setIcon(pMgr.getApplicationIcon(aInfo));
    if (Arrays.binarySearch(tordApps,apps[appIdx].getUsername()) >= 0) {
      apps[appIdx].setTorified(true);
    }
 else {
      apps[appIdx].setTorified(false);
    }
    appIdx++;
  }
  return apps;
}

Fixed version (ground truth):
public static TorifiedApp[] getApps(Context context){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  String tordAppString=prefs.getString(PREFS_KEY_TORIFIED,"String_Node_Str");
  String[] tordApps;
  StringTokenizer st=new StringTokenizer(tordAppString,"String_Node_Str");
  tordApps=new String[st.countTokens()];
  int tordIdx=0;
  while (st.hasMoreTokens()) {
    tordApps[tordIdx++]=st.nextToken();
  }
  Arrays.sort(tordApps);
  PackageManager pMgr=context.getPackageManager();
  List<ApplicationInfo> lAppInfo=pMgr.getInstalledApplications(0);
  Iterator<ApplicationInfo> itAppInfo=lAppInfo.iterator();
  apps=new TorifiedApp[lAppInfo.size()];
  ApplicationInfo aInfo=null;
  int appIdx=0;
  while (itAppInfo.hasNext()) {
    aInfo=itAppInfo.next();
    apps[appIdx]=new TorifiedApp();
    apps[appIdx].setEnabled(aInfo.enabled);
    apps[appIdx].setUid(aInfo.uid);
    apps[appIdx].setUsername(pMgr.getNameForUid(apps[appIdx].getUid()));
    apps[appIdx].setProcname(aInfo.processName);
    apps[appIdx].setName(pMgr.getApplicationLabel(aInfo).toString());
    apps[appIdx].setIcon(pMgr.getApplicationIcon(aInfo));
    if (Arrays.binarySearch(tordApps,apps[appIdx].getUsername()) >= 0) {
      apps[appIdx].setTorified(true);
    }
 else {
      apps[appIdx].setTorified(false);
    }
    appIdx++;
  }
  return apps;
}
Program: 24991
Project: 24991
Buggy source:
private void showMain(){
  bindService();
  currentView=R.layout.layout_main;
  setContentView(currentView);
  findViewById(R.id.imgStatus).setOnClickListener(this);
  findViewById(R.id.lblStatus).setOnClickListener(this);
  lblStatus=(TextView)findViewById(R.id.lblStatus);
  imgStatus=(ImageView)findViewById(R.id.imgStatus);
}

Fixed version (ground truth):
private void showMain(){
  bindService();
  currentView=R.layout.layout_main;
  setContentView(currentView);
  findViewById(R.id.imgStatus).setOnClickListener(this);
  findViewById(R.id.lblStatus).setOnClickListener(this);
  lblStatus=(TextView)findViewById(R.id.lblStatus);
  imgStatus=(ImageView)findViewById(R.id.imgStatus);
  updateStatus("String_Node_Str");
}
Program: 24993
Project: 24993
Buggy source:
protected void onResume(){
  super.onResume();
  NotificationManager mNotificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  mNotificationManager.cancelAll();
  if (mService != null) {
    try {
      processSettings();
    }
 catch (    RemoteException e) {
      e.printStackTrace();
    }
  }
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mOrbot);
  boolean showWizard=prefs.getBoolean("String_Node_Str",true);
  if (showWizard) {
    Editor pEdit=prefs.edit();
    pEdit.putBoolean("String_Node_Str",false);
    pEdit.commit();
    showHelp();
  }
}

Fixed version (ground truth):
protected void onResume(){
  super.onResume();
  NotificationManager mNotificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  mNotificationManager.cancelAll();
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mOrbot);
  boolean showWizard=prefs.getBoolean("String_Node_Str",true);
  if (showWizard) {
    Editor pEdit=prefs.edit();
    pEdit.putBoolean("String_Node_Str",false);
    pEdit.commit();
    showHelp();
  }
 else {
  }
}
Program: 24995
Project: 24995
Buggy source:
private void showSettings(){
  startActivity(new Intent(this,SettingsPreferences.class));
}

Fixed version (ground truth):
private void showSettings(){
  startActivityForResult(new Intent(this,SettingsPreferences.class),1);
}
Program: 24996
Project: 24996
Buggy source:
@Override public boolean onPreferenceClick(Preference preference){
  if (preference == prefTransProxyApps) {
    startActivity(new Intent(this,AppManager.class));
  }
 else   if (preference == prefWebProxy) {
    Intent intent=new Intent();
    intent.setClassName(this,"String_Node_Str");
    intent.putExtra("String_Node_Str","String_Node_Str");
    intent.putExtra("String_Node_Str","String_Node_Str");
    startActivity(intent);
  }
 else {
    prefcBTransProxyAll.setEnabled(prefCBTransProxy.isChecked());
    prefTransProxyApps.setEnabled(prefCBTransProxy.isChecked() && (!prefcBTransProxyAll.isChecked()));
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onPreferenceClick(Preference preference){
  if (preference == prefTransProxyApps) {
    startActivity(new Intent(this,AppManager.class));
  }
 else {
    prefcBTransProxyAll.setEnabled(prefCBTransProxy.isChecked());
    prefTransProxyApps.setEnabled(prefCBTransProxy.isChecked() && (!prefcBTransProxyAll.isChecked()));
  }
  return true;
}
Program: 24997
Project: 24997
Buggy source:
public void start(boolean force){
  boolean torBinaryExists=new File(TOR_BINARY_INSTALL_PATH).exists();
  Log.i(TAG,"String_Node_Str" + torBinaryExists);
  boolean privoxyBinaryExists=new File(PRIVOXY_INSTALL_PATH).exists();
  Log.i(TAG,"String_Node_Str" + privoxyBinaryExists);
  if (!(torBinaryExists && privoxyBinaryExists) || force)   installFromZip();
}

Fixed version (ground truth):
public void start(boolean force){
  boolean torBinaryExists=new File(installPath + TOR_BINARY_ASSET_KEY).exists();
  Log.i(TAG,"String_Node_Str" + torBinaryExists);
  boolean privoxyBinaryExists=new File(installPath + PRIVOXY_ASSET_KEY).exists();
  Log.i(TAG,"String_Node_Str" + privoxyBinaryExists);
  if (!(torBinaryExists && privoxyBinaryExists) || force)   installFromZip();
}
Program: 24998
Project: 24998
Buggy source:
public TorBinaryInstaller(){
}

Fixed version (ground truth):
public TorBinaryInstaller(String installPath,String apkPath){
  this.installPath=installPath;
  this.apkPath=apkPath;
}
Program: 24999
Project: 24999
Buggy source:
private void installFromZip(){
  try {
    String apkPath=APK_PATH;
    int apkIdx=1;
    while (!new File(apkPath).exists()) {
      apkPath=APK_PATH_BASE + '-' + (apkIdx++)+ "String_Node_Str";
      Log.i(TAG,"String_Node_Str" + apkPath);
    }
    ZipFile zip=new ZipFile(apkPath);
    ZipEntry zipen=zip.getEntry(TOR_BINARY_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),TOR_BINARY_INSTALL_PATH);
    zipen=zip.getEntry(TORRC_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),TORRC_INSTALL_PATH);
    zipen=zip.getEntry(PRIVOXY_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),PRIVOXY_INSTALL_PATH);
    zipen=zip.getEntry(PRIVOXYCONFIG_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),PRIVOXYCONFIG_INSTALL_PATH);
    zip.close();
    Log.i(TAG,"String_Node_Str");
  }
 catch (  IOException ioe) {
    Log.i(TAG,"String_Node_Str",ioe);
  }
}

Fixed version (ground truth):
private void installFromZip(){
  try {
    ZipFile zip=new ZipFile(apkPath);
    ZipEntry zipen=zip.getEntry(TOR_BINARY_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),installPath + TOR_BINARY_ASSET_KEY);
    zipen=zip.getEntry(TORRC_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),installPath + TORRC_ASSET_KEY);
    zipen=zip.getEntry(PRIVOXY_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),installPath + PRIVOXY_ASSET_KEY);
    zipen=zip.getEntry(PRIVOXYCONFIG_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),installPath + PRIVOXYCONFIG_ASSET_KEY);
    zip.close();
    Log.i(TAG,"String_Node_Str");
  }
 catch (  IOException ioe) {
    Log.i(TAG,"String_Node_Str",ioe);
  }
}
Program: 25000
Project: 25000
Buggy source:
private void runTorShellCmd() throws Exception {
  StringBuilder log=new StringBuilder();
  Log.i(TAG,"String_Node_Str");
  String[] torCmd={TOR_BINARY_INSTALL_PATH + ' ' + TOR_COMMAND_LINE_ARGS};
  TorServiceUtils.doShellCommand(torCmd,log,false,false);
  Thread.sleep(1000);
  int procId=TorServiceUtils.findProcessId(TorServiceConstants.TOR_BINARY_INSTALL_PATH);
  int attempts=0;
  while (procId == -1 && attempts < MAX_START_TRIES) {
    log=new StringBuilder();
    logNotice(torCmd[0]);
    TorServiceUtils.doShellCommand(torCmd,log,false,false);
    procId=TorServiceUtils.findProcessId(TorServiceConstants.TOR_BINARY_INSTALL_PATH);
    if (procId == -1) {
      sendCallbackMessage("String_Node_Str" + log.toString());
      Thread.sleep(1000);
      sendCallbackMessage(getString(R.string.status_starting_up));
      Thread.sleep(3000);
      attempts++;
    }
    logNotice(log.toString());
  }
  if (procId == -1) {
    throw new Exception("String_Node_Str");
  }
 else {
    logNotice("String_Node_Str" + procId);
    showToolbarNotification(getString(R.string.status_starting_up),R.drawable.tornotification);
    initControlConnection();
  }
}

Fixed version (ground truth):
private void runTorShellCmd() throws Exception {
  StringBuilder log=new StringBuilder();
  Log.i(TAG,"String_Node_Str");
  String torrcPath=appHome + TORRC_ASSET_KEY;
  String[] torCmd={torBinaryPath + "String_Node_Str" + torrcPath+ "String_Node_Str"};
  TorServiceUtils.doShellCommand(torCmd,log,false,false);
  Thread.sleep(1000);
  int procId=TorServiceUtils.findProcessId(torBinaryPath);
  int attempts=0;
  while (procId == -1 && attempts < MAX_START_TRIES) {
    log=new StringBuilder();
    logNotice(torCmd[0]);
    TorServiceUtils.doShellCommand(torCmd,log,false,false);
    procId=TorServiceUtils.findProcessId(torBinaryPath);
    if (procId == -1) {
      sendCallbackMessage("String_Node_Str" + log.toString());
      Thread.sleep(1000);
      sendCallbackMessage(getString(R.string.status_starting_up));
      Thread.sleep(3000);
      attempts++;
    }
    logNotice(log.toString());
  }
  if (procId == -1) {
    throw new Exception("String_Node_Str");
  }
 else {
    logNotice("String_Node_Str" + procId);
    showToolbarNotification(getString(R.string.status_starting_up),R.drawable.tornotification);
    initControlConnection();
  }
}
Program: 25001
Project: 25001
Buggy source:
private void runPrivoxyShellCmd() throws Exception {
  int privoxyProcId=TorServiceUtils.findProcessId(TorServiceConstants.PRIVOXY_INSTALL_PATH);
  StringBuilder log=null;
  int attempts=0;
  while (privoxyProcId == -1 && attempts < MAX_START_TRIES) {
    log=new StringBuilder();
    String[] cmds={PRIVOXY_INSTALL_PATH + "String_Node_Str" + PRIVOXY_COMMAND_LINE_ARGS};
    logNotice(cmds[0]);
    TorServiceUtils.doShellCommand(cmds,log,false,true);
    Thread.sleep(1000);
    privoxyProcId=TorServiceUtils.findProcessId(TorServiceConstants.PRIVOXY_INSTALL_PATH);
    if (privoxyProcId == -1) {
      logNotice("String_Node_Str" + log);
      Thread.sleep(3000);
      attempts++;
    }
    logNotice(log.toString());
  }
  sendCallbackMessage("String_Node_Str" + PORT_HTTP);
  Thread.sleep(100);
  logNotice("String_Node_Str" + privoxyProcId);
}

Fixed version (ground truth):
private void runPrivoxyShellCmd() throws Exception {
  int privoxyProcId=TorServiceUtils.findProcessId(privoxyPath);
  StringBuilder log=null;
  int attempts=0;
  while (privoxyProcId == -1 && attempts < MAX_START_TRIES) {
    log=new StringBuilder();
    String privoxyConfigPath=appHome + PRIVOXYCONFIG_ASSET_KEY;
    String[] cmds={privoxyPath + "String_Node_Str" + privoxyConfigPath};
    logNotice(cmds[0]);
    TorServiceUtils.doShellCommand(cmds,log,false,true);
    Thread.sleep(1000);
    privoxyProcId=TorServiceUtils.findProcessId(privoxyPath);
    if (privoxyProcId == -1) {
      logNotice("String_Node_Str" + log);
      Thread.sleep(3000);
      attempts++;
    }
    logNotice(log.toString());
  }
  sendCallbackMessage("String_Node_Str" + PORT_HTTP);
  Thread.sleep(100);
  logNotice("String_Node_Str" + privoxyProcId);
}
Program: 25002
Project: 25002
Buggy source:
private boolean findExistingProc(){
  int procId=TorServiceUtils.findProcessId(TorServiceConstants.TOR_BINARY_INSTALL_PATH);
  if (procId != -1) {
    Log.i(TAG,"String_Node_Str");
    sendCallbackMessage("String_Node_Str");
    try {
      currentStatus=STATUS_CONNECTING;
      initControlConnection();
      currentStatus=STATUS_ON;
      return true;
    }
 catch (    RuntimeException e) {
      Log.i(TAG,"String_Node_Str",e);
      currentStatus=STATUS_OFF;
      this.stopTor();
    }
catch (    Exception e) {
      Log.i(TAG,"String_Node_Str",e);
      currentStatus=STATUS_OFF;
      this.stopTor();
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean findExistingProc(){
  int procId=TorServiceUtils.findProcessId(torBinaryPath);
  if (procId != -1) {
    Log.i(TAG,"String_Node_Str");
    sendCallbackMessage("String_Node_Str");
    try {
      currentStatus=STATUS_CONNECTING;
      initControlConnection();
      currentStatus=STATUS_ON;
      return true;
    }
 catch (    RuntimeException e) {
      Log.i(TAG,"String_Node_Str",e);
      currentStatus=STATUS_OFF;
      this.stopTor();
    }
catch (    Exception e) {
      Log.i(TAG,"String_Node_Str",e);
      currentStatus=STATUS_OFF;
      this.stopTor();
    }
  }
  return false;
}
Program: 25003
Project: 25003
Buggy source:
public void initControlConnection() throws Exception, RuntimeException {
  while (true) {
    try {
      Log.i(TAG,"String_Node_Str" + TOR_CONTROL_PORT);
      String baseMessage=getString(R.string.tor_process_connecting);
      sendCallbackMessage(baseMessage);
      Socket s=new Socket(IP_LOCALHOST,TOR_CONTROL_PORT);
      conn=TorControlConnection.getConnection(s);
      sendCallbackMessage(getString(R.string.tor_process_connecting_step2));
      Log.i(TAG,"String_Node_Str");
      File fileCookie=new File(TOR_CONTROL_AUTH_COOKIE);
      byte[] cookie=new byte[(int)fileCookie.length()];
      new FileInputStream(new File(TOR_CONTROL_AUTH_COOKIE)).read(cookie);
      conn.authenticate(cookie);
      Log.i(TAG,"String_Node_Str");
      sendCallbackMessage(getString(R.string.tor_process_connecting_step2) + getString(R.string.tor_process_connecting_step3));
      addEventHandler();
      if (configBuffer != null) {
        conn.setConf(configBuffer);
        configBuffer=null;
      }
      break;
    }
 catch (    Exception ce) {
      conn=null;
      Log.i(TAG,"String_Node_Str" + ce.getLocalizedMessage(),ce);
      sendCallbackMessage(getString(R.string.tor_process_connecting_step4));
      Thread.sleep(1000);
    }
  }
}

Fixed version (ground truth):
public void initControlConnection() throws Exception, RuntimeException {
  while (true) {
    try {
      Log.i(TAG,"String_Node_Str" + TOR_CONTROL_PORT);
      String baseMessage=getString(R.string.tor_process_connecting);
      sendCallbackMessage(baseMessage);
      Socket s=new Socket(IP_LOCALHOST,TOR_CONTROL_PORT);
      conn=TorControlConnection.getConnection(s);
      sendCallbackMessage(getString(R.string.tor_process_connecting_step2));
      Log.i(TAG,"String_Node_Str");
      String torAuthCookie=appHome + "String_Node_Str";
      File fileCookie=new File(torAuthCookie);
      byte[] cookie=new byte[(int)fileCookie.length()];
      new FileInputStream(new File(torAuthCookie)).read(cookie);
      conn.authenticate(cookie);
      Log.i(TAG,"String_Node_Str");
      sendCallbackMessage(getString(R.string.tor_process_connecting_step2) + getString(R.string.tor_process_connecting_step3));
      addEventHandler();
      if (configBuffer != null) {
        conn.setConf(configBuffer);
        configBuffer=null;
      }
      break;
    }
 catch (    Exception ce) {
      conn=null;
      Log.i(TAG,"String_Node_Str" + ce.getLocalizedMessage(),ce);
      sendCallbackMessage(getString(R.string.tor_process_connecting_step4));
      Thread.sleep(1000);
    }
  }
}
Program: 25004
Project: 25004
Buggy source:
/** 
 * Called when the activity is first created. 
 */
public void onCreate(){
  super.onCreate();
  Log.i(TAG,"String_Node_Str");
  checkTorBinaries();
  findExistingProc();
  _torInstance=this;
  hasRoot=TorServiceUtils.hasRoot();
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
public void onCreate(){
  super.onCreate();
  Log.i(TAG,"String_Node_Str");
}
Program: 25005
Project: 25005
Buggy source:
public IBinder onBind(Intent intent){
  if (ITorService.class.getName().equals(intent.getAction())) {
    return mBinder;
  }
  return null;
}

Fixed version (ground truth):
public IBinder onBind(Intent intent){
  if (appHome == null) {
    checkTorBinaries();
    findExistingProc();
    _torInstance=this;
    hasRoot=TorServiceUtils.hasRoot();
  }
  if (ITorService.class.getName().equals(intent.getAction())) {
    return mBinder;
  }
  return null;
}
Program: 25006
Project: 25006
Buggy source:
private void killTorProcess(){
  if (conn != null) {
    try {
      logNotice("String_Node_Str");
      conn.signal("String_Node_Str");
    }
 catch (    Exception e) {
      Log.i(TAG,"String_Node_Str",e);
    }
    conn=null;
  }
  StringBuilder log=new StringBuilder();
  int procId=TorServiceUtils.findProcessId(TorServiceConstants.TOR_BINARY_INSTALL_PATH);
  while (procId != -1) {
    logNotice("String_Node_Str" + procId + "String_Node_Str");
    String[] cmd={SHELL_CMD_KILL + ' ' + procId+ "String_Node_Str"};
    TorServiceUtils.doShellCommand(cmd,log,false,false);
    procId=TorServiceUtils.findProcessId(TorServiceConstants.TOR_BINARY_INSTALL_PATH);
  }
  procId=TorServiceUtils.findProcessId(TorServiceConstants.PRIVOXY_INSTALL_PATH);
  while (procId != -1) {
    Log.i(TAG,"String_Node_Str" + procId + "String_Node_Str");
    String[] cmd={SHELL_CMD_KILL + ' ' + procId+ "String_Node_Str"};
    TorServiceUtils.doShellCommand(cmd,log,false,false);
    procId=TorServiceUtils.findProcessId(TorServiceConstants.PRIVOXY_INSTALL_PATH);
  }
}

Fixed version (ground truth):
private void killTorProcess(){
  if (conn != null) {
    try {
      logNotice("String_Node_Str");
      conn.signal("String_Node_Str");
    }
 catch (    Exception e) {
      Log.i(TAG,"String_Node_Str",e);
    }
    conn=null;
  }
  StringBuilder log=new StringBuilder();
  int procId=TorServiceUtils.findProcessId(torBinaryPath);
  while (procId != -1) {
    logNotice("String_Node_Str" + procId + "String_Node_Str");
    String[] cmd={SHELL_CMD_KILL + ' ' + procId+ "String_Node_Str"};
    TorServiceUtils.doShellCommand(cmd,log,false,false);
    procId=TorServiceUtils.findProcessId(torBinaryPath);
  }
  procId=TorServiceUtils.findProcessId(privoxyPath);
  while (procId != -1) {
    Log.i(TAG,"String_Node_Str" + procId + "String_Node_Str");
    String[] cmd={SHELL_CMD_KILL + ' ' + procId+ "String_Node_Str"};
    TorServiceUtils.doShellCommand(cmd,log,false,false);
    procId=TorServiceUtils.findProcessId(privoxyPath);
  }
}
Program: 25007
Project: 25007
Buggy source:
private boolean checkTorBinaries(){
  boolean torBinaryExists=new File(TOR_BINARY_INSTALL_PATH).exists();
  boolean privoxyBinaryExists=new File(PRIVOXY_INSTALL_PATH).exists();
  if (!(torBinaryExists && privoxyBinaryExists)) {
    killTorProcess();
    TorBinaryInstaller installer=new TorBinaryInstaller();
    installer.start(true);
    torBinaryExists=new File(TOR_BINARY_INSTALL_PATH).exists();
    privoxyBinaryExists=new File(PRIVOXY_INSTALL_PATH).exists();
    if (torBinaryExists && privoxyBinaryExists) {
      logNotice(getString(R.string.status_install_success));
      showToolbarNotification(getString(R.string.status_install_success),R.drawable.tornotification);
    }
 else {
      logNotice(getString(R.string.status_install_fail));
      showAlert(getString(R.string.title_error),getString(R.string.status_install_fail));
      return false;
    }
  }
  StringBuilder log=new StringBuilder();
  logNotice("String_Node_Str");
  String[] cmd1={SHELL_CMD_CHMOD + ' ' + CHMOD_EXE_VALUE+ ' '+ TOR_BINARY_INSTALL_PATH};
  TorServiceUtils.doShellCommand(cmd1,log,false,true);
  logNotice("String_Node_Str");
  String[] cmd2={SHELL_CMD_CHMOD + ' ' + CHMOD_EXE_VALUE+ ' '+ PRIVOXY_INSTALL_PATH};
  TorServiceUtils.doShellCommand(cmd2,log,false,true);
  return true;
}

Fixed version (ground truth):
private boolean checkTorBinaries(){
  Log.i(TAG,"String_Node_Str");
  appHome="String_Node_Str" + TOR_APP_USERNAME + "String_Node_Str";
  Log.i(TAG,"String_Node_Str" + appHome);
  String apkPath=findAPK();
  Log.i(TAG,"String_Node_Str" + apkPath);
  boolean apkExists=new File(apkPath).exists();
  if (!apkExists) {
    Log.w(TAG,"String_Node_Str" + apkPath);
    Log.w(TAG,"String_Node_Str");
    return false;
  }
  torBinaryPath=appHome + '/' + TOR_BINARY_ASSET_KEY;
  privoxyPath=appHome + '/' + PRIVOXY_ASSET_KEY;
  boolean torBinaryExists=new File(torBinaryPath).exists();
  boolean privoxyBinaryExists=new File(privoxyPath).exists();
  if (!(torBinaryExists && privoxyBinaryExists)) {
    killTorProcess();
    TorBinaryInstaller installer=new TorBinaryInstaller(appHome,apkPath);
    installer.start(true);
    torBinaryExists=new File(torBinaryPath).exists();
    privoxyBinaryExists=new File(privoxyPath).exists();
    if (torBinaryExists && privoxyBinaryExists) {
      logNotice(getString(R.string.status_install_success));
      showToolbarNotification(getString(R.string.status_install_success),R.drawable.tornotification);
    }
 else {
      logNotice(getString(R.string.status_install_fail));
      sendCallbackMessage(getString(R.string.status_install_fail));
      return false;
    }
  }
  StringBuilder log=new StringBuilder();
  logNotice("String_Node_Str");
  String[] cmd1={SHELL_CMD_CHMOD + ' ' + CHMOD_EXE_VALUE+ ' '+ torBinaryPath};
  TorServiceUtils.doShellCommand(cmd1,log,false,true);
  logNotice("String_Node_Str");
  String[] cmd2={SHELL_CMD_CHMOD + ' ' + CHMOD_EXE_VALUE+ ' '+ privoxyPath};
  TorServiceUtils.doShellCommand(cmd2,log,false,true);
  return true;
}
Program: 25008
Project: 25008
Buggy source:
private void installFromZip(){
  try {
    ZipFile zip=new ZipFile(APK_PATH);
    ZipEntry zipen=zip.getEntry(TOR_BINARY_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),TOR_BINARY_INSTALL_PATH);
    zipen=zip.getEntry(TORRC_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),TORRC_INSTALL_PATH);
    zipen=zip.getEntry(PRIVOXY_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),PRIVOXY_INSTALL_PATH);
    zipen=zip.getEntry(PRIVOXYCONFIG_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),PRIVOXYCONFIG_INSTALL_PATH);
    zip.close();
    Log.i(TAG,"String_Node_Str");
  }
 catch (  IOException ioe) {
    Log.i(TAG,"String_Node_Str",ioe);
  }
}

Fixed version (ground truth):
private void installFromZip(){
  try {
    String apkPath=APK_PATH;
    int apkIdx=1;
    while (!new File(apkPath).exists()) {
      apkPath=APK_PATH_BASE + '-' + (apkIdx++)+ "String_Node_Str";
      Log.i(TAG,"String_Node_Str" + apkPath);
    }
    ZipFile zip=new ZipFile(apkPath);
    ZipEntry zipen=zip.getEntry(TOR_BINARY_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),TOR_BINARY_INSTALL_PATH);
    zipen=zip.getEntry(TORRC_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),TORRC_INSTALL_PATH);
    zipen=zip.getEntry(PRIVOXY_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),PRIVOXY_INSTALL_PATH);
    zipen=zip.getEntry(PRIVOXYCONFIG_ZIP_KEY);
    streamToFile(zip.getInputStream(zipen),PRIVOXYCONFIG_INSTALL_PATH);
    zip.close();
    Log.i(TAG,"String_Node_Str");
  }
 catch (  IOException ioe) {
    Log.i(TAG,"String_Node_Str",ioe);
  }
}
Program: 25009
Project: 25009
Buggy source:
private void showHelp(){
  LayoutInflater li=LayoutInflater.from(this);
  View view=li.inflate(R.layout.layout_help,null);
  StringBuilder msg=new StringBuilder();
  msg.append(R.string.help_text_1);
  msg.append("String_Node_Str");
  msg.append(R.string.help_text_2);
  msg.append("String_Node_Str");
  msg.append(R.string.help_text_3);
  msg.append("String_Node_Str");
  msg.append(R.string.help_text_4);
  msg.append("String_Node_Str");
  msg.append(R.string.help_text_5);
  msg.append("String_Node_Str");
  new AlertDialog.Builder(this).setTitle(getString(R.string.menu_info)).setMessage(msg).setView(view).setNeutralButton(getString(R.string.button_about),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      showAbout();
    }
  }
).setNegativeButton(getString(R.string.button_close),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
    }
  }
).show();
}

Fixed version (ground truth):
private void showHelp(){
  LayoutInflater li=LayoutInflater.from(this);
  View view=li.inflate(R.layout.layout_help,null);
  StringBuilder msg=new StringBuilder();
  msg.append(getString(R.string.help_text_1));
  msg.append("String_Node_Str");
  msg.append(getString(R.string.help_text_2));
  msg.append("String_Node_Str");
  msg.append(getString(R.string.help_text_3));
  msg.append("String_Node_Str");
  msg.append(getString(R.string.help_text_4));
  msg.append("String_Node_Str");
  msg.append(getString(R.string.help_text_5));
  msg.append("String_Node_Str");
  new AlertDialog.Builder(this).setTitle(getString(R.string.menu_info)).setMessage(msg.toString()).setView(view).setNeutralButton(getString(R.string.button_about),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      showAbout();
    }
  }
).setNegativeButton(getString(R.string.button_close),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
    }
  }
).show();
}
Program: 25012
Project: 25012
Buggy source:
private void showAlert(String msg){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setMessage(msg);
  AlertDialog alert=builder.create();
}

Fixed version (ground truth):
private void showAlert(String title,String msg){
  new AlertDialog.Builder(this).setTitle(title).setMessage(msg).setPositiveButton(android.R.string.ok,null).show();
}
Program: 25013
Project: 25013
Buggy source:
public void onClick(View view){
  if (view.getId() == R.id.imgStatus || view.getId() == R.id.lblStatus) {
    try {
      if (mService == null) {
      }
 else       if (mService.getStatus() == STATUS_READY) {
        mService.setProfile(PROFILE_ON);
        imgStatus.setImageResource(R.drawable.torstarting);
        lblStatus.setText(getString(R.string.status_starting_up));
        Message msg=mHandler.obtainMessage(ENABLE_TOR_MSG);
        mHandler.sendMessage(msg);
        updateStatus("String_Node_Str");
      }
 else {
        mService.setProfile(PROFILE_ONDEMAND);
        Message msg=mHandler.obtainMessage(DISABLE_TOR_MSG);
        mHandler.sendMessage(msg);
        updateStatus("String_Node_Str");
      }
    }
 catch (    Exception e) {
      Log.i(TAG,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public void onClick(View view){
  if (view.getId() == R.id.imgStatus || view.getId() == R.id.lblStatus) {
    try {
      if (mService == null) {
      }
 else       if (mService.getStatus() == STATUS_READY) {
        startTor();
      }
 else {
        stopTor();
      }
    }
 catch (    Exception e) {
      Log.i(TAG,"String_Node_Str",e);
    }
  }
}
Program: 25014
Project: 25014
Buggy source:
@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
  super.onMenuItemSelected(featureId,item);
  if (item.getItemId() == 1) {
    this.showMain();
  }
 else   if (item.getItemId() == 4) {
    this.showSettings();
  }
 else   if (item.getItemId() == 6) {
    this.showMessageLog();
  }
 else   if (item.getItemId() == 2) {
    openBrowser(URL_TOR_CHECK);
  }
 else   if (item.getItemId() == 3) {
    showHelp();
  }
 else   if (item.getItemId() == 5) {
    showApps();
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
  super.onMenuItemSelected(featureId,item);
  if (item.getItemId() == 1) {
    try {
      if (mService == null) {
      }
 else       if (mService.getStatus() == STATUS_READY) {
        mItemOnOff.setTitle(R.string.menu_stop);
        startTor();
      }
 else {
        mItemOnOff.setTitle(R.string.menu_start);
        stopTor();
      }
    }
 catch (    RemoteException re) {
      Log.w(TAG,"String_Node_Str",re);
    }
  }
 else   if (item.getItemId() == 4) {
    this.showSettings();
  }
 else   if (item.getItemId() == 6) {
    this.showMessageLog();
  }
 else   if (item.getItemId() == 2) {
    openBrowser(URL_TOR_CHECK);
  }
 else   if (item.getItemId() == 3) {
    showHelp();
  }
 else   if (item.getItemId() == 5) {
    showApps();
  }
  return true;
}
Program: 25015
Project: 25015
Buggy source:
public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuItem mItem=null;
  mItem=menu.add(0,4,Menu.NONE,getString(R.string.menu_settings));
  mItem.setIcon(R.drawable.ic_menu_register);
  mItem=menu.add(0,5,Menu.NONE,getString(R.string.menu_apps));
  mItem.setIcon(R.drawable.ic_menu_goto);
  if (!TorServiceUtils.hasRoot()) {
    mItem.setEnabled(false);
  }
  mItem=menu.add(0,6,Menu.NONE,getString(R.string.menu_log));
  mItem.setIcon(R.drawable.ic_menu_reports);
  mItem=menu.add(0,3,Menu.NONE,getString(R.string.menu_info));
  mItem.setIcon(R.drawable.ic_menu_about);
  return true;
}

Fixed version (ground truth):
public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  MenuItem mItem=null;
  mItemOnOff=menu.add(0,1,Menu.NONE,getString(R.string.menu_start));
  mItemOnOff.setIcon(android.R.drawable.ic_menu_share);
  mItem=menu.add(0,4,Menu.NONE,getString(R.string.menu_settings));
  mItem.setIcon(R.drawable.ic_menu_register);
  mItem=menu.add(0,5,Menu.NONE,getString(R.string.menu_apps));
  mItem.setIcon(R.drawable.ic_menu_goto);
  if (!TorServiceUtils.hasRoot()) {
    mItem.setEnabled(false);
  }
  mItem=menu.add(0,6,Menu.NONE,getString(R.string.menu_log));
  mItem.setIcon(R.drawable.ic_menu_reports);
  mItem=menu.add(0,3,Menu.NONE,getString(R.string.menu_info));
  mItem.setIcon(R.drawable.ic_menu_about);
  return true;
}
Program: 25016
Project: 25016
Buggy source:
/** 
 * Called when the activity is first created.
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  setContentView(R.layout.player_1);
  mPreview=(SurfaceView)findViewById(R.id.SurfaceView01);
  mFrameLayout=(FrameLayout)findViewById(R.id.FrameLayout01);
  holder=mPreview.getHolder();
  holder.addCallback(this);
  mFrameLayout.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      mTick=0;
      DimableControls.setVisibility(View.VISIBLE);
    }
  }
);
  holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  extras=getIntent().getExtras();
  PodCastUrl=extras.getString("String_Node_Str");
  PodCastTitle=extras.getString("String_Node_Str");
  PodCastLength=extras.getInt("String_Node_Str",0);
  PodCastLenkb=extras.getInt("String_Node_Str",0);
  isAudio=extras.getInt("String_Node_Str",0) == 1;
  PowerManager pm=(PowerManager)getSystemService(Context.POWER_SERVICE);
  mWakeLock=pm.newWakeLock(isAudio ? PowerManager.SCREEN_DIM_WAKE_LOCK : PowerManager.SCREEN_BRIGHT_WAKE_LOCK,"String_Node_Str");
  tv=(TextView)findViewById(R.id.text_kb_streamed);
  tv.setText(PodCastTitle);
  initControls();
  myRefreshThread=new Thread(new secondCountDownRunner());
  myRefreshThread.start();
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created.
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  setContentView(R.layout.player_1);
  mPreview=(SurfaceView)findViewById(R.id.SurfaceView01);
  mFrameLayout=(FrameLayout)findViewById(R.id.FrameLayout01);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
  holder=mPreview.getHolder();
  holder.addCallback(this);
  mFrameLayout.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      mTick=0;
      DimableControls.setVisibility(View.VISIBLE);
      showStatusBar();
    }
  }
);
  holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  extras=getIntent().getExtras();
  PodCastUrl=extras.getString("String_Node_Str");
  PodCastTitle=extras.getString("String_Node_Str");
  PodCastLength=extras.getInt("String_Node_Str",0);
  PodCastLenkb=extras.getInt("String_Node_Str",0);
  isAudio=extras.getInt("String_Node_Str",0) == 1;
  PowerManager pm=(PowerManager)getSystemService(Context.POWER_SERVICE);
  mWakeLock=pm.newWakeLock(isAudio ? PowerManager.SCREEN_DIM_WAKE_LOCK : PowerManager.SCREEN_BRIGHT_WAKE_LOCK,"String_Node_Str");
  tv=(TextView)findViewById(R.id.text_kb_streamed);
  tv.setText(PodCastTitle);
  initControls();
  myRefreshThread=new Thread(new secondCountDownRunner());
  myRefreshThread.start();
}
Program: 25017
Project: 25017
Buggy source:
public void handleMessage(Message msg){
switch (msg.what) {
case TMRMSG:
    if (prog != null && mMediaPlayer != null) {
      int a=mMediaPlayer.getDuration();
      if (a == 0) {
        break;
      }
      all.setText(TimeFromMS(a));
      int b=mMediaPlayer.getCurrentPosition();
      cur.setText(TimeFromMS(b));
      int pct=(b * 100) / a;
      prog.setProgress(pct);
    }
  if (extras.getInt(MEDIA) != LOCAL_AUDIO) {
    mTick++;
    if (mTick >= 8) {
      mTick=0;
      DimableControls.setVisibility(View.INVISIBLE);
    }
  }
break;
}
super.handleMessage(msg);
}

Fixed version (ground truth):
public void handleMessage(Message msg){
switch (msg.what) {
case TMRMSG:
    if (prog != null && mMediaPlayer != null) {
      int a=mMediaPlayer.getDuration();
      if (a == 0) {
        break;
      }
      all.setText(TimeFromMS(a));
      int b=mMediaPlayer.getCurrentPosition();
      cur.setText(TimeFromMS(b));
      int pct=(b * 100) / a;
      prog.setProgress(pct);
    }
  if (extras.getInt(MEDIA) != LOCAL_AUDIO) {
    mTick++;
    if (mTick >= 8) {
      mTick=0;
      DimableControls.setVisibility(View.INVISIBLE);
      hideStatusBar();
    }
  }
break;
}
super.handleMessage(msg);
}
Program: 25019
Project: 25019
Buggy source:
@Override public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
  if (fromUser) {
    try {
      if (mSecondaryService.getIsPlaying()) {
        int a=mSecondaryService.getDuration();
        if (a == 0) {
          return;
        }
        int b=mSecondaryService.getCurrentPosition();
        int pct=(b * 100) / a;
        prog.setProgress(pct);
        int where=(int)((float)a * ((float)progress / 100.0f));
        mSecondaryService.SeekTo(where);
      }
    }
 catch (    Exception e) {
      Log.d(TAG,"String_Node_Str" + e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
@Override public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
  if (fromUser) {
    try {
      if (mSecondaryService.getIsPlaying()) {
        int a=mSecondaryService.getDuration();
        if (a == 0) {
          return;
        }
        int where=(int)((float)a * ((float)progress / 100.0f));
        mSecondaryService.SeekTo(where);
      }
    }
 catch (    Exception e) {
      Log.d(TAG,"String_Node_Str" + e.getMessage(),e);
    }
  }
}
Program: 25020
Project: 25020
Buggy source:
public static void AI(){
  State s=new State();
  s.printState();
  StateNode node=new StateNode(null,s);
  alphaBeta(node,depth,Integer.MIN_VALUE,Integer.MAX_VALUE,MAX_PLAYER);
  node.getBestMove().makeMove();
}

Fixed version (ground truth):
public static void AI(){
  State s=new State();
  StateNode node=new StateNode(null,s);
  alphaBeta(node,depth,Integer.MIN_VALUE,Integer.MAX_VALUE,MAX_PLAYER);
  node.getBestMove().makeMove();
}
Program: 25021
Project: 25021
Buggy source:
public static int alphaBeta(StateNode node,int depth,int a,int b,boolean player){
  if (depth == 0 || node.state.endGame()) {
    return node.state.evaluate();
  }
  Enumeration<StateNode> sne=node.successors();
  StateNode current=null;
  int alpha=a, beta=b;
  if (player == MAX_PLAYER) {
    while (sne.hasMoreElements()) {
      current=sne.nextElement();
      current.state.printState();
      alpha=max(alpha,alphaBeta(current,depth - 1,alpha,beta,!player),node,current);
      if (beta <= alpha)       break;
    }
    return alpha;
  }
 else {
    while (sne.hasMoreElements()) {
      current=sne.nextElement();
      current.state.printState();
      beta=min(beta,alphaBeta(current,depth - 1,alpha,beta,!player),node,current);
      if (beta <= alpha)       break;
    }
    return beta;
  }
}

Fixed version (ground truth):
public static int alphaBeta(StateNode node,int depth,int a,int b,boolean player){
  if (depth == 0 || node.state.endGame()) {
    return node.state.evaluate();
  }
  Enumeration<StateNode> sne=node.successors();
  StateNode current=null;
  int alpha=a, beta=b;
  if (player == MAX_PLAYER) {
    while (sne.hasMoreElements()) {
      current=sne.nextElement();
      alpha=max(alpha,alphaBeta(current,depth - 1,alpha,beta,!player),node,current);
      if (beta <= alpha)       break;
    }
    return alpha;
  }
 else {
    while (sne.hasMoreElements()) {
      current=sne.nextElement();
      beta=min(beta,alphaBeta(current,depth - 1,alpha,beta,!player),node,current);
      if (beta <= alpha)       break;
    }
    return beta;
  }
}
Program: 25022
Project: 25022
Buggy source:
private boolean anyLines(Position position){
  if (position.z >= 2)   return false;
  for (  List<Position> line : position.lines()) {
    boolean validLine=true;
    for (    Position p : line) {
      int ball=state[p.z][p.y][p.x];
      if (p != position && ball == 0 || ball == opponnent) {
        validLine=false;
        break;
      }
    }
    if (validLine)     return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean anyLines(Position position){
  if (position.z >= 2)   return false;
  for (  List<Position> line : position.lines()) {
    boolean validLine=true;
    for (    Position p : line) {
      int ball=state[p.z][p.y][p.x];
      if ((ball == 0 && p != position) || (ball != 0 && ball != currentPlayer)) {
        validLine=false;
        break;
      }
    }
    if (validLine)     return true;
  }
  return false;
}
Program: 25023
Project: 25023
Buggy source:
private boolean anySquares(Position position){
  if (position.z >= 2)   return false;
  for (  List<Position> square : position.fourSquare()) {
    boolean validSquare=true;
    for (    Position p : square) {
      int ball=state[p.z][p.y][p.z];
      if (p != position && ball == 0 || ball == opponnent) {
        validSquare=false;
        break;
      }
    }
    if (validSquare)     return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean anySquares(Position position){
  if (position.z >= 2)   return false;
  for (  List<Position> square : position.fourSquare()) {
    boolean validSquare=true;
    for (    Position p : square) {
      int ball=state[p.z][p.y][p.z];
      if ((ball == 0 && p != position) || (ball != 0 && ball != currentPlayer)) {
        validSquare=false;
        break;
      }
    }
    if (validSquare)     return true;
  }
  return false;
}
Program: 25024
Project: 25024
Buggy source:
private void generateNext(){
  if (accessibles.isEmpty()) {
    current=null;
    currentState=null;
  }
 else {
    Position new_pos=accessibles.get(0);
    accessibles.remove(new_pos);
    if (new_state.createsLineOrSquare(new_pos)) {
      current=new RemovableEnumerator(new_state,new_pos);
      currentState=null;
    }
 else {
      Ply ply=new MountBall(from,new_pos,new Position[0]);
      currentState=new StateNode(ply,ply.apply(state));
      current=null;
    }
  }
}

Fixed version (ground truth):
private void generateNext(){
  if (accessibles.isEmpty()) {
    current=null;
    currentState=null;
  }
 else {
    Position new_pos=accessibles.get(0);
    accessibles.remove(new_pos);
    if (new_state.createsLineOrSquare(new_pos)) {
      current=new RemovableEnumerator(new_state,new_pos);
      currentState=null;
    }
 else {
      Ply ply=new MountBall(from,new_pos,new Position[0]);
      currentState=new StateNode(ply,ply.applyAndSwitchPlayer(state));
      current=null;
    }
  }
}
Program: 25025
Project: 25025
Buggy source:
public RemovableEnumerator(State state,Position p){
  Ply ply=new Ply(p,null);
  to=p;
  this.state=state;
  ns=ply.apply(state);
  ns.currentPlayer=state.currentPlayer;
  next=null;
  x1=y1=z1=0;
  x2=y2=z2=0;
}

Fixed version (ground truth):
public RemovableEnumerator(State state,Position p){
  Ply ply=new Ply(p,null);
  to=p;
  this.state=state;
  ns=ply.apply(state);
  next=null;
  x1=y1=z1=0;
  x2=y2=z2=0;
}
Program: 25026
Project: 25026
Buggy source:
public State apply(State s){
  State state=new State(s);
  if (at != null) {
    state.state[at.z][at.y][at.x]=state.currentPlayer;
    state.ballOnSide[s.currentPlayer - 1]--;
  }
  if (removes != null) {
    for (    Position remove : removes) {
      Position p=remove;
      state.state[p.z][p.y][p.x]=0;
      state.ballOnSide[state.currentPlayer - 1]++;
    }
  }
  state.swichPlayers();
  return state;
}

Fixed version (ground truth):
public State apply(State s){
  State state=new State(s);
  if (at != null) {
    state.state[at.z][at.y][at.x]=state.currentPlayer;
    state.ballOnSide[s.currentPlayer - 1]--;
  }
  if (removes != null) {
    for (    Position remove : removes) {
      Position p=remove;
      state.state[p.z][p.y][p.x]=0;
      state.ballOnSide[state.currentPlayer - 1]++;
    }
  }
  return state;
}
Program: 25027
Project: 25027
Buggy source:
public Iterator<GameState> iterator(){
  List<GameState> list=new LinkedList<GameState>();
  return list.iterator();
}

Fixed version (ground truth):
public Iterator<GameState> iterator(){
  List<GameState> list=new LinkedList<GameState>();
  State s;
  for (  Move move : possibleMoves) {
    if (move.removeStep) {
      for (      Remove r : move.removables) {
        move.remove=r;
        s=move.doMove(state);
        s.switchPlayer();
        list.add(new GameState(this,s,move));
      }
    }
 else {
      s=move.doMove(state);
      s.switchPlayer();
      list.add(new GameState(this,s,move));
    }
  }
  return list.iterator();
}
Program: 25028
Project: 25028
Buggy source:
public void generatePosibleMoves(){
  for (int z=0; z < Model.LEVELS; z++) {
    for (int y=0; y < Model.LEVELS - z; y++) {
      for (int x=0; x < Model.LEVELS - z; x++) {
        int ball=state.state[z][y][x];
        if (ball == 0 && state.accessible(x,y,z)) {
          Move move=new Move(x,y,z);
          move.hasRemoveStep(state);
          possibleMoves.add(move);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void generatePosibleMoves(){
  for (int z=0; z < Model.LEVELS; z++) {
    for (int y=0; y < Model.LEVELS - z; y++) {
      for (int x=0; x < Model.LEVELS - z; x++) {
        int ball=state.state[z][y][x];
        if (ball == 0 && state.accessible(x,y,z)) {
          Move move=new Move(x,y,z);
          move.hasRemoveStep(state);
          possibleMoves.add(move);
        }
 else         if (ball == state.currentPlayer && state.isMountable(Position.at(x,y,z))) {
          for (          Move toMount : state.addPositionToMount(Position.at(x,y,z))) {
            toMount.hasRemoveStep(state);
            possibleMoves.add(toMount);
          }
        }
      }
    }
  }
}
Program: 25029
Project: 25029
Buggy source:
public boolean accessibleIgnoring(Position accessible,Position ignore){
  if (state[accessible.z][accessible.y][accessible.x] != 0)   return accessible == ignore;
  if (accessible.z == 0)   return true;
  for (int x=accessible.x; x <= accessible.x + 1; x++) {
    for (int y=accessible.y; y <= accessible.y + 1; y++) {
      if (state[accessible.z - 1][y][x] == 0 || accessible == ignore)       return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean accessibleIgnoring(Position accessible,Position ignore){
  if (state[accessible.z][accessible.y][accessible.x] != 0)   return accessible == ignore;
  if (accessible.z == 0)   return true;
  for (int x=accessible.x; x <= accessible.x + 1; x++) {
    for (int y=accessible.y; y <= accessible.y + 1; y++) {
      if (state[accessible.z - 1][y][x] == 0 || Position.at(x,y,accessible.z - 1) == ignore)       return false;
    }
  }
  return true;
}
Program: 25030
Project: 25030
Buggy source:
public State(State s){
  state=s.state;
  ballOnSide=s.ballOnSide;
  currentPlayer=s.currentPlayer;
}

Fixed version (ground truth):
public State(State s){
  state=copy(s.state);
  ballOnSide[0]=s.ballOnSide[0];
  ballOnSide[1]=s.ballOnSide[1];
  currentPlayer=s.currentPlayer;
}
Program: 25031
Project: 25031
Buggy source:
public Mount(int x,int y,int z,int ix,int iy,int iz){
  super(x,y,z);
  mountedRemoved=new Remove(ix,iy,iz);
}

Fixed version (ground truth):
public Mount(Position toPlace,Position toRemove){
  super(toPlace);
  mountedRemoved=new Remove(toRemove);
}
Program: 25032
Project: 25032
Buggy source:
/** 
 * changer les attributs de move Move >> place une boule qq part Mount >> enleve la boule a monter et la place avec l'attribut de move Remove >> Enleve 1 ou 2 boules (cmt identifier 1 ou 2 ? 2eme classe ?)
 */
public String toString(){
  return super.toString() + "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * changer les attributs de move Move >> place une boule qq part Mount >> enleve la boule a monter et la place avec l'attribut de move Remove >> Enleve 1 ou 2 boules (cmt identifier 1 ou 2 ? 2eme classe ?)
 */
public String toString(){
  return "String_Node_Str" + mountedRemoved.toString() + "String_Node_Str"+ super.toString();
}
Program: 25033
Project: 25033
Buggy source:
public String toString(){
  String s="String_Node_Str" + hasSecond + "String_Node_Str";
  s+="String_Node_Str" + position.x + "String_Node_Str"+ position.y+ "String_Node_Str"+ position.z+ "String_Node_Str";
  if (hasSecond)   s+="String_Node_Str" + second.x + "String_Node_Str"+ second.y+ "String_Node_Str"+ second.z+ "String_Node_Str";
  return s;
}

Fixed version (ground truth):
public String toString(){
  String s="String_Node_Str" + position.x + "String_Node_Str"+ position.y+ "String_Node_Str"+ position.z+ "String_Node_Str";
  if (hasSecond)   s+="String_Node_Str" + second.x + "String_Node_Str"+ second.y+ "String_Node_Str"+ second.z+ "String_Node_Str";
  return s;
}
Program: 25034
Project: 25034
Buggy source:
public void testAccessible(){
  MainTest.gameSample();
  State s=new State();
  assertTrue(s.accessible(3,0,0));
}

Fixed version (ground truth):
public void testAccessible(){
  MainTest.gameSample();
  State s=new State();
  assertTrue(s.accessible(3,0,0));
  assertTrue(s.accessible(1,0,1));
}