nus-yam/ex-repair huggingface dataset:
Program: 19974
Project: 19974
Buggy source:
/** 
 * K�sittelee n�pp�inpainalluksen.
 * @param _keyCode N�pp�imen tunnus
 * @param _event   Androidin generoima n�pp�intapahtuma
 * @return K�siteltiink� tapahtuma
 */
public boolean handleKeyDown(int _keyCode,KeyEvent _event){
  if (_keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
    Log.v("String_Node_Str","String_Node_Str");
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
    Log.v("String_Node_Str","String_Node_Str");
    angle=180;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
    Log.v("String_Node_Str","String_Node_Str");
    angle=0;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_UP) {
    Log.v("String_Node_Str","String_Node_Str");
    angle=90;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
    Log.v("String_Node_Str","String_Node_Str");
    angle=270;
  }
  wrapper.player.movementTargetDirection=angle;
  wrapper.player.movementAcceleration=0;
  wrapper.player.setMovementSpeed(1.0f);
  wrapper.player.setMovementDelay(1.0f);
  return true;
}

Fixed version (ground truth):
/** 
 * K�sittelee n�pp�inpainalluksen.
 * @param _keyCode N�pp�imen tunnus
 * @param _event   Androidin generoima n�pp�intapahtuma
 * @return K�siteltiink� tapahtuma
 */
public boolean handleKeyDown(int _keyCode,KeyEvent _event){
  if (_keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
    angle=180;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
    angle=0;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_UP) {
    angle=90;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
    angle=270;
  }
  wrapper.player.movementTargetDirection=angle;
  wrapper.player.movementAcceleration=0;
  wrapper.player.setMovementSpeed(1.0f);
  wrapper.player.setMovementDelay(1.0f);
  return true;
}
Program: 19975
Project: 19975
Buggy source:
public boolean handleKeyUp(int _keyCode,KeyEvent _event){
  if (_keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
    Log.v("String_Node_Str","String_Node_Str");
    return false;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
    Log.v("String_Node_Str","String_Node_Str");
    wrapper.player.movementAcceleration=-6;
    return false;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
    Log.v("String_Node_Str","String_Node_Str");
    wrapper.player.movementAcceleration=-6;
    return false;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_UP) {
    Log.v("String_Node_Str","String_Node_Str");
    wrapper.player.movementAcceleration=-6;
    return false;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
    Log.v("String_Node_Str","String_Node_Str");
    wrapper.player.movementAcceleration=-6;
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean handleKeyUp(int _keyCode,KeyEvent _event){
  if (_keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
    return false;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
    wrapper.player.movementAcceleration=-6;
    return false;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
    wrapper.player.movementAcceleration=-6;
    return false;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_UP) {
    wrapper.player.movementAcceleration=-6;
    return false;
  }
 else   if (_keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
    wrapper.player.movementAcceleration=-6;
    return false;
  }
  return true;
}
Program: 19979
Project: 19979
Buggy source:
/** 
 * K�sittelee t�rm�ykset.
 * @param _eventType T�rm�ystyyppi
 * @param _damage Vahinko
 * @param _armorPiercing Panssarinl�p�isykyky
 */
@Override public final void triggerCollision(int _eventType,int _damage,int _armorPiercing){
  if (_eventType == GameObject.COLLISION_WITH_PROJECTILE) {
    if (currentArmor > 0) {
      EffectManager.showEnemyArmorEffect(this);
    }
    Utility.checkDamage(this,_damage,_armorPiercing);
    if (currentHealth <= 0) {
      triggerDestroyed();
    }
  }
 else   if (_eventType == GameObject.COLLISION_WITH_PLAYER) {
    triggerDestroyed();
  }
  if (_eventType == GameObject.COLLISION_WITH_OBSTACLE) {
    triggerDestroyed();
  }
}

Fixed version (ground truth):
/** 
 * K�sittelee t�rm�ykset.
 * @param _eventType T�rm�ystyyppi
 * @param _damage Vahinko
 * @param _armorPiercing Panssarinl�p�isykyky
 */
@Override public final void triggerCollision(int _eventType,int _damage,int _armorPiercing){
  if (_eventType == GameObject.COLLISION_WITH_PROJECTILE) {
    if (currentArmor > 0) {
      EffectManager.showEnemyArmorEffect(this);
    }
    Utility.checkDamage(this,_damage,_armorPiercing);
    if (currentHealth <= 0) {
      GameMode.updateScore(rank,x,y);
      triggerDestroyed();
    }
  }
 else   if (_eventType == GameObject.COLLISION_WITH_PLAYER) {
    triggerDestroyed();
  }
  if (_eventType == GameObject.COLLISION_WITH_OBSTACLE) {
    triggerDestroyed();
  }
}
Program: 19980
Project: 19980
Buggy source:
/** 
 * K�sittelee jonkin toiminnon p��ttymisen. Kutsutaan animaation loputtua, mik�li actionActivated on TRUE. K�ytet��n esimerkiksi objektin tuhoutuessa. Objektille m��ritet��n animaatioksi sen tuhoutumisanimaatio, tilaksi Wrapperissa m��ritet��n 2 (piirret��n, mutta p�ivitet��n ainoastaan animaatio) ja asetetaan actionActivatedin arvoksi TRUE. T�ll�in GameThread p�ivitt�� objektin animaation, Renderer piirt�� sen, ja kun animaatio p��ttyy, kutsutaan objektin triggerEndOfAction-funktiota. T�ss� funktiossa objekti k�sittelee tilansa. Tuhoutumisanimaation tapauksessa objekti m��ritt�� itsens� ep�aktiiviseksi. Jokainen objekti luo funktiosta oman toteutuksensa, sill� toimintoja voi olla useita. Objekteilla on my�s k�yt�ss��n actionId-muuttuja, jolle voidaan asettaa haluttu arvo. T�m� arvo kertoo objektille, mink� toiminnon se juuri suoritti. Toimintojen vakiot l�ytyv�t GfxObject-luokan alusta.
 */
@Override protected void triggerEndOfAction(){
  if (actionId == GfxObject.ACTION_DESTROYED) {
    --GameMode.enemiesLeft;
    GameMode.updateScore(rank,x,y);
    setUnactive();
  }
 else   if (actionId == GfxObject.ACTION_ENABLED) {
    wrapper.enemyStates.set(listId,1);
  }
  movementAcceleration=0;
  setMovementDelay(1.0f);
  setMovementSpeed(1.0f);
}

Fixed version (ground truth):
/** 
 * K�sittelee jonkin toiminnon p��ttymisen. Kutsutaan animaation loputtua, mik�li actionActivated on TRUE. K�ytet��n esimerkiksi objektin tuhoutuessa. Objektille m��ritet��n animaatioksi sen tuhoutumisanimaatio, tilaksi Wrapperissa m��ritet��n 2 (piirret��n, mutta p�ivitet��n ainoastaan animaatio) ja asetetaan actionActivatedin arvoksi TRUE. T�ll�in GameThread p�ivitt�� objektin animaation, Renderer piirt�� sen, ja kun animaatio p��ttyy, kutsutaan objektin triggerEndOfAction-funktiota. T�ss� funktiossa objekti k�sittelee tilansa. Tuhoutumisanimaation tapauksessa objekti m��ritt�� itsens� ep�aktiiviseksi. Jokainen objekti luo funktiosta oman toteutuksensa, sill� toimintoja voi olla useita. Objekteilla on my�s k�yt�ss��n actionId-muuttuja, jolle voidaan asettaa haluttu arvo. T�m� arvo kertoo objektille, mink� toiminnon se juuri suoritti. Toimintojen vakiot l�ytyv�t GfxObject-luokan alusta.
 */
@Override protected void triggerEndOfAction(){
  if (actionId == GfxObject.ACTION_DESTROYED) {
    --GameMode.enemiesLeft;
    setUnactive();
  }
 else   if (actionId == GfxObject.ACTION_ENABLED) {
    wrapper.enemyStates.set(listId,1);
  }
  movementAcceleration=0;
  setMovementDelay(1.0f);
  setMovementSpeed(1.0f);
}
Program: 19983
Project: 19983
Buggy source:
/** 
 * @return scores-taulukko
 */
public final int[] readHighScores(){
  File file=new File(Environment.getExternalStorageDirectory() + "String_Node_Str");
  FileInputStream fis=null;
  int[] scores=new int[5];
  try {
    fis=new FileInputStream(file);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Log.e("String_Node_Str","String_Node_Str" + e.getMessage());
  }
  XmlPullParser parser=Xml.newPullParser();
  try {
    parser.setInput(fis,"String_Node_Str");
  }
 catch (  XmlPullParserException e) {
    e.printStackTrace();
    Log.e("String_Node_Str","String_Node_Str" + e.getMessage());
  }
  int index=0;
  if (parser != null) {
    try {
      while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
        if (parser.getEventType() == XmlPullParser.START_TAG) {
          if (parser.getName().equals("String_Node_Str")) {
            scores[index - 1]=Integer.parseInt(parser.getAttributeValue(null,"String_Node_Str"));
          }
          ++index;
        }
 else         if (parser.getEventType() == XmlPullParser.END_TAG) {
        }
        parser.next();
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
      Log.e("String_Node_Str","String_Node_Str" + e.getMessage());
    }
  }
  try {
    fis.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return scores;
}

Fixed version (ground truth):
/** 
 * @return scores-taulukko
 */
public final int[] readHighScores(){
  File file=new File(Environment.getExternalStorageDirectory() + "String_Node_Str");
  FileInputStream fis=null;
  int[] scores=new int[5];
  try {
    fis=new FileInputStream(file);
    XmlPullParser parser=Xml.newPullParser();
    parser.setInput(fis,"String_Node_Str");
    int index=0;
    if (parser != null) {
      while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
        if (parser.getEventType() == XmlPullParser.START_TAG) {
          if (parser.getName().equals("String_Node_Str")) {
            scores[index - 1]=Integer.parseInt(parser.getAttributeValue(null,"String_Node_Str"));
          }
          ++index;
        }
 else         if (parser.getEventType() == XmlPullParser.END_TAG) {
        }
        parser.next();
      }
    }
    fis.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return scores;
}
Program: 19984
Project: 19984
Buggy source:
/** 
 * K�ynnist�� uuden vihollisaallon asettamalla siihen kuuluvat viholliset aktiivisiksi.
 */
@Override public void startWave(){
  if (currentWave == AMOUNT_OF_WAVES) {
    currentWave=0;
    int rankTemp;
    for (int index=enemies.size() - 1; index >= 0; --index) {
      if (enemies.get(index).rank <= 4) {
        rankTemp=enemies.get(index).rank;
        enemies.get(index).setStats(enemyStats[rankTemp][0],enemyStats[rankTemp][1],enemyStats[rankTemp][2],enemyStats[rankTemp][3],enemyStats[rankTemp][4],rankTemp + 1);
      }
    }
  }
  int temp;
  int tempRandA, tempRandB;
  for (int index=0; index < AMOUNT_OF_ENEMIES_PER_WAVE; ++index) {
    if (waves[currentWave][index] != -1) {
      temp=waves[currentWave][index];
      tempRandA=randomGen.nextInt(7) + 1;
      tempRandB=randomGen.nextInt(2);
      enemies.get(temp).setActive();
      enemies.get(temp).x=spawnPoints[1][tempRandB][0];
      enemies.get(temp).y=spawnPoints[1][tempRandB][1];
      ++enemiesLeft;
    }
  }
  ++currentWave;
}

Fixed version (ground truth):
/** 
 * K�ynnist�� uuden vihollisaallon asettamalla siihen kuuluvat viholliset aktiivisiksi.
 */
@Override public void startWave(){
  if (currentWave == AMOUNT_OF_WAVES) {
    currentWave=0;
    int rankTemp;
    for (int index=enemies.size() - 1; index >= 0; --index) {
      if (enemies.get(index).rank <= 4) {
        rankTemp=enemies.get(index).rank;
        enemies.get(index).setStats(enemyStats[rankTemp][0],enemyStats[rankTemp][1],enemyStats[rankTemp][2],enemyStats[rankTemp][3],enemyStats[rankTemp][4],rankTemp + 1);
      }
    }
  }
  int temp;
  int tempRandA, tempRandB;
  for (int index=0; index < AMOUNT_OF_ENEMIES_PER_WAVE; ++index) {
    if (waves[currentWave][index] != -1) {
      temp=waves[currentWave][index];
      tempRandA=randomGen.nextInt(7) + 1;
      tempRandB=randomGen.nextInt(2);
      enemies.get(temp).setActive();
      enemies.get(temp).x=spawnPoints[tempRandA][tempRandB][0];
      enemies.get(temp).y=spawnPoints[tempRandA][tempRandB][1];
      ++enemiesLeft;
    }
  }
  ++currentWave;
}
Program: 19988
Project: 19988
Buggy source:
public void updateCooldownIcon(int _cooldown){
  usedTexture=GLRenderer.TEXTURE_COOLDOWN + (int)((((float)_cooldown / (float)DEVIDER) * 20));
  Log.e("String_Node_Str",String.valueOf(usedTexture));
}

Fixed version (ground truth):
public void updateCooldownIcon(int _cooldown){
  usedTexture=GLRenderer.TEXTURE_COOLDOWN + (int)((((float)_cooldown / (float)DEVIDER) * 20));
  if (_cooldown <= 0)   usedTexture=GLRenderer.TEXTURE_COOLDOWN;
}
Program: 19989
Project: 19989
Buggy source:
public final void activate(int _direction,boolean _autoSpecial,AbstractWeapon _parent,float _startX,float _startY){
  if (explodeTime > 0) {
    startTime=android.os.SystemClock.uptimeMillis();
  }
  x=_startX;
  y=_startY;
  parent=_parent;
  direction=_direction;
  explodeOnTarget=false;
  wrapper.projectileStates.set(listId,1);
  active=true;
  if (_autoSpecial) {
    triggerSpecialAction();
  }
}

Fixed version (ground truth):
public final void activate(int _direction,boolean _explodeOnTarget,boolean _autoSpecial,AbstractWeapon _parent,float _startX,float _startY){
  if (explodeTime > 0) {
    startTime=android.os.SystemClock.uptimeMillis();
  }
  x=_startX;
  y=_startY;
  parent=_parent;
  direction=_direction;
  explodeOnTarget=_explodeOnTarget;
  wrapper.projectileStates.set(listId,1);
  active=true;
  if (_autoSpecial) {
    triggerSpecialAction();
  }
}
Program: 19991
Project: 19991
Buggy source:
/** 
 * Aktivoi ammukset. T�st� eteenp�in ammusten oma teko�ly hoitaa niiden p�ivitt�misen.
 * @param int Kohteen X-koordinaatti
 * @param int Kohteen Y-koordinaatti
 */
@Override public final void activate(int _x,int _y){
  for (int i=15; i >= 0; --i) {
    if (!projectiles.get(i).active) {
      projectiles.get(i).activate(_x,_y,false,this,wrapper.player.x,wrapper.player.y);
      SoundManager.playSound(3,1);
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Aktivoi ammukset. T�st� eteenp�in ammusten oma teko�ly hoitaa niiden p�ivitt�misen.
 * @param int Kohteen X-koordinaatti
 * @param int Kohteen Y-koordinaatti
 */
@Override public final void activate(int _x,int _y){
  for (int i=15; i >= 0; --i) {
    if (!projectiles.get(i).active) {
      projectiles.get(i).activate(_x,_y,true,false,this,wrapper.player.x,wrapper.player.y);
      SoundManager.playSound(3,1);
      break;
    }
  }
}
Program: 19992
Project: 19992
Buggy source:
/** 
 * Aktivoi r�j�hdyksess� tarvittavat ammukset. 
 * @param int   Aktivoitavien ammusten m��r� 
 * @param float Aloituskohdan X-koordinaatti
 * @param float Aloituskohdan Y-koordinaatti
 */
@Override public final void triggerCluster(int _amount,float _startX,float _startY){
  int loopAmount=0;
  for (int i=15; i >= 0; --i) {
    if (!projectiles.get(i).active) {
      projectiles.get(i).activate(loopAmount * 45,false,this,_startX,_startY);
      ++loopAmount;
      if (loopAmount == _amount) {
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Aktivoi r�j�hdyksess� tarvittavat ammukset. 
 * @param int   Aktivoitavien ammusten m��r� 
 * @param float Aloituskohdan X-koordinaatti
 * @param float Aloituskohdan Y-koordinaatti
 */
@Override public final void triggerCluster(int _amount,float _startX,float _startY){
  int loopAmount=0;
  for (int i=15; i >= 0; --i) {
    if (!projectiles.get(i).active) {
      projectiles.get(i).activate(loopAmount * 45,false,false,this,_startX,_startY);
      ++loopAmount;
      if (loopAmount == _amount) {
        break;
      }
    }
  }
}
Program: 19993
Project: 19993
Buggy source:
/** 
 * Aktivoi ammukset. T�st� eteenp�in ammusten oma teko�ly hoitaa niiden p�ivitt�misen.
 * @param int Kohteen X-koordinaatti
 * @param int Kohteen Y-koordinaatti
 */
@Override public final void activate(int _x,int _y){
  for (int i=0; i < 10; ++i) {
    if (projectiles.get(i).active == false) {
      projectiles.get(i).activate(_x,_y,false,this,wrapper.player.x,wrapper.player.y);
      SoundManager.playSound(3,1);
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Aktivoi ammukset. T�st� eteenp�in ammusten oma teko�ly hoitaa niiden p�ivitt�misen.
 * @param int Kohteen X-koordinaatti
 * @param int Kohteen Y-koordinaatti
 */
@Override public final void activate(int _x,int _y){
  for (int i=0; i < 10; ++i) {
    if (projectiles.get(i).active == false) {
      projectiles.get(i).activate(_x,_y,false,false,this,wrapper.player.x,wrapper.player.y);
      SoundManager.playSound(3,1);
      break;
    }
  }
}
Program: 19994
Project: 19994
Buggy source:
/** 
 * Aktivoi ammukset. T�st� eteenp�in ammusten oma teko�ly hoitaa niiden p�ivitt�misen.
 * @param int Kohteen X-koordinaatti
 * @param int Kohteen Y-koordinaatti
 */
@Override public final void activate(int _x,int _y){
  if (!projectile.active) {
    projectile.activate(_x,_y,true,this,wrapper.player.x,wrapper.player.y);
    SoundManager.playSound(3,1);
  }
}

Fixed version (ground truth):
/** 
 * Aktivoi ammukset. T�st� eteenp�in ammusten oma teko�ly hoitaa niiden p�ivitt�misen.
 * @param int Kohteen X-koordinaatti
 * @param int Kohteen Y-koordinaatti
 */
@Override public final void activate(int _x,int _y){
  if (!projectile.active) {
    projectile.activate(_x,_y,false,true,this,wrapper.player.x,wrapper.player.y);
    SoundManager.playSound(3,1);
  }
}
Program: 19995
Project: 19995
Buggy source:
/** 
 * Aktivoi ammukset. T�st� eteenp�in ammusten oma teko�ly hoitaa niiden p�ivitt�misen.
 * @param int Kohteen X-koordinaatti
 * @param int Kohteen Y-koordinaatti
 */
@Override public final void activate(int _x,int _y){
  if (!projectile.active) {
    projectile.activate(_x,_y,true,this,wrapper.player.x,wrapper.player.y);
    SoundManager.playSound(3,1);
  }
}

Fixed version (ground truth):
/** 
 * Aktivoi ammukset. T�st� eteenp�in ammusten oma teko�ly hoitaa niiden p�ivitt�misen.
 * @param int Kohteen X-koordinaatti
 * @param int Kohteen Y-koordinaatti
 */
@Override public final void activate(int _x,int _y){
  if (!projectile.active) {
    projectile.activate(_x,_y,false,true,this,wrapper.player.x,wrapper.player.y);
    SoundManager.playSound(3,1);
  }
}
Program: 19996
Project: 19996
Buggy source:
/** 
 * K�sitelee t�rm�ykset pelaajan ja ammusten kanssa.
 * @param int T�rm�ystyyppi
 * @param int Vahinko
 * @param int Panssarinl�p�isykyky
 */
@Override public final void triggerCollision(int _eventType,int _damage,int _armorPiercing){
  if (_eventType == GameObject.COLLISION_WITH_PROJECTILE) {
    health-=(int)((float)_damage * (1 - 0.15 * (float)defence + 0.1 * (float)_armorPiercing));
    if (health <= 0) {
      wrapper.enemyStates.set(listId,2);
      setAction(GLRenderer.ANIMATION_DESTROY,1,1,1);
    }
  }
 else   if (_eventType == GameObject.COLLISION_WITH_PLAYER) {
    wrapper.enemyStates.set(listId,2);
    setAction(GLRenderer.ANIMATION_DESTROY,1,1,1);
  }
}

Fixed version (ground truth):
/** 
 * K�sitelee t�rm�ykset pelaajan ja ammusten kanssa.
 * @param int T�rm�ystyyppi
 * @param int Vahinko
 * @param int Panssarinl�p�isykyky
 */
@Override public final void triggerCollision(int _eventType,int _damage,int _armorPiercing){
  if (_eventType == GameObject.COLLISION_WITH_PROJECTILE) {
    health-=(int)((float)_damage * (1 - 0.15 * (float)defence + 0.1 * (float)_armorPiercing));
    if (health <= 0) {
      triggerDestroyed();
    }
  }
 else   if (_eventType == GameObject.COLLISION_WITH_PLAYER) {
    triggerDestroyed();
  }
}
Program: 19997
Project: 19997
Buggy source:
/** 
 * K�sittelee r�j�hdyksien aiheuttamat osumat.
 * @param int Vahinko
 */
@Override public final void triggerImpact(int _damage){
  health-=(int)((float)_damage * (1 - 0.15 * (float)defence));
  if (health <= 0) {
    wrapper.enemyStates.set(listId,2);
    setAction(GLRenderer.ANIMATION_DESTROY,1,1,1);
  }
}

Fixed version (ground truth):
/** 
 * K�sittelee r�j�hdyksien aiheuttamat osumat.
 * @param int Vahinko
 */
@Override public final void triggerImpact(int _damage){
  health-=(int)((float)_damage * (1 - 0.15 * (float)defence));
  if (health <= 0) {
    triggerDestroyed();
  }
}
Program: 20000
Project: 20000
Buggy source:
public boolean onTouch(View v,MotionEvent event){
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    xClickOffset=(int)event.getX();
    yClickOffset=screenHeight - (int)event.getY();
    if (xClickOffset > screenWidth - 100 * Options.scale && xClickOffset < screenWidth) {
      if (yClickOffset < yClickFirstBorder * Options.scale && yClickOffset > 0) {
        hud.triggerClick(Hud.BUTTON_3);
      }
 else       if (yClickOffset < yClickSecondBorder * Options.scale && yClickOffset > 66 * Options.scale) {
        hud.triggerClick(Hud.BUTTON_2);
      }
 else       if (yClickOffset < yClickThirdBorder * Options.scale && yClickOffset > 132 * Options.scale) {
        hud.triggerClick(Hud.BUTTON_1);
      }
    }
 else     if (xClickOffset < 64 * Options.scale && xClickOffset > 0) {
      if (yClickOffset < yClickFirstBorder * Options.scale && yClickOffset > 0) {
        hud.triggerClick(Hud.SPECIAL_2);
      }
 else       if (yClickOffset < yClickSecondBorder * Options.scale && yClickOffset > 66 * Options.scale) {
        hud.triggerClick(Hud.SPECIAL_1);
      }
    }
 else {
      weaponManager.triggerShoot(convertCoords((int)event.getX(),(int)event.getY()));
    }
    return true;
  }
  if (event.getAction() == MotionEvent.ACTION_UP) {
    if (Math.abs(event.getX() - xClickOffset) < touchMarginal && Math.abs(event.getY() - yClickOffset) < touchMarginal) {
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean onTouch(View v,MotionEvent event){
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    xClickOffset=(int)event.getX();
    yClickOffset=screenHeight - (int)event.getY();
    if (xClickOffset > screenWidth - 100 * Options.scale && xClickOffset < screenWidth && yClickOffset < yClickThirdBorder * Options.scale) {
      if (yClickOffset < yClickFirstBorder * Options.scale && yClickOffset > 0) {
        hud.triggerClick(Hud.BUTTON_3);
      }
 else       if (yClickOffset < yClickSecondBorder * Options.scale && yClickOffset > 66 * Options.scale) {
        hud.triggerClick(Hud.BUTTON_2);
      }
 else       if (yClickOffset < yClickThirdBorder * Options.scale && yClickOffset > 132 * Options.scale) {
        hud.triggerClick(Hud.BUTTON_1);
      }
    }
 else     if (xClickOffset < screenWidth - 700 * Options.scale && xClickOffset > 0 && yClickOffset < yClickThirdBorder * Options.scale) {
      if (yClickOffset < yClickFirstBorder * Options.scale && yClickOffset > 0) {
        hud.triggerClick(Hud.SPECIAL_2);
      }
 else       if (yClickOffset < yClickSecondBorder * Options.scale && yClickOffset > 66 * Options.scale) {
        hud.triggerClick(Hud.SPECIAL_1);
      }
    }
 else {
      weaponManager.triggerShoot(convertCoords((int)event.getX(),(int)event.getY()));
    }
    return true;
  }
  if (event.getAction() == MotionEvent.ACTION_UP) {
    if (Math.abs(event.getX() - xClickOffset) < touchMarginal && Math.abs(event.getY() - yClickOffset) < touchMarginal) {
    }
    return true;
  }
  return false;
}
Program: 20001
Project: 20001
Buggy source:
/** 
 * K�sittelee ammuksen teko�lyn.
 */
public final void handleAi(){
  for (int i=wrapper.enemies.size() - 1; i >= 0; --i) {
    if (wrapper.enemyStates.get(i) == 1) {
      double distance=Math.sqrt(Math.pow(x - wrapper.enemies.get(i).x,2) + Math.pow(y - wrapper.enemies.get(i).y,2));
      if (distance - wrapper.enemies.get(i).collisionRadius - collisionRadius <= 0) {
        wrapper.projectileStates.set(listId,2);
        if (damageType == ProjectileLaser.DAMAGE_ON_TOUCH) {
          wrapper.enemies.get(i).triggerCollision(GameObject.COLLISION_WITH_PROJECTILE,damageOnTouch,armorPiercing);
          setAction(GLRenderer.ANIMATION_DESTROY,1,1);
        }
 else         if (damageType == ProjectileLaser.EXPLODE_ON_TOUCH) {
          setAction(GLRenderer.ANIMATION_DESTROY,1,1);
          causeExplosion();
        }
        break;
      }
      if (distance - wrapper.enemies.get(i).collisionRadius - damageRadius <= 0) {
        wrapper.enemies.get(i).health-=(damageOnRadius * (1 - 0.15 * wrapper.enemies.get(i).defence));
      }
    }
  }
  if (explodeTime > 0) {
    currentTime=android.os.SystemClock.uptimeMillis();
    if (currentTime - startTime >= explodeTime) {
      wrapper.projectileStates.set(listId,2);
      setAction(GLRenderer.ANIMATION_DESTROY,1,1);
      causeExplosion();
    }
  }
  if (wrapper.player.x + x < -400 || wrapper.player.x + x > 400 || wrapper.player.y + y < -240 || wrapper.player.y + y > 240) {
    setUnactive();
  }
}

Fixed version (ground truth):
/** 
 * K�sittelee ammuksen teko�lyn.
 */
public final void handleAi(){
  for (int i=wrapper.enemies.size() - 1; i >= 0; --i) {
    if (wrapper.enemyStates.get(i) == 1) {
      double distance=Math.sqrt(Math.pow(x - wrapper.enemies.get(i).x,2) + Math.pow(y - wrapper.enemies.get(i).y,2));
      if (distance - wrapper.enemies.get(i).collisionRadius - collisionRadius <= 0) {
        wrapper.projectileStates.set(listId,2);
        if (damageType == ProjectileLaser.DAMAGE_ON_TOUCH) {
          wrapper.enemies.get(i).triggerCollision(GameObject.COLLISION_WITH_PROJECTILE,damageOnTouch,armorPiercing);
          setAction(GLRenderer.ANIMATION_DESTROY,1,1);
        }
 else         if (damageType == ProjectileLaser.EXPLODE_ON_TOUCH) {
          setAction(GLRenderer.ANIMATION_DESTROY,1,1);
          causeExplosion();
        }
        break;
      }
      if (distance - wrapper.enemies.get(i).collisionRadius - damageRadius <= 0) {
        wrapper.enemies.get(i).health-=(damageOnRadius * (1 - 0.15 * wrapper.enemies.get(i).defence));
      }
    }
  }
  if (explodeTime > 0) {
    currentTime=android.os.SystemClock.uptimeMillis();
    if (currentTime - startTime >= explodeTime) {
      wrapper.projectileStates.set(listId,2);
      setAction(GLRenderer.ANIMATION_DESTROY,1,1);
      causeExplosion();
    }
  }
  if (wrapper.player.x + x < -400 * Options.scale || wrapper.player.x + x > 400 * Options.scale || wrapper.player.y + y < -240 * Options.scale || wrapper.player.y + y > 240 * Options.scale) {
    setUnactive();
  }
}
Program: 20002
Project: 20002
Buggy source:
/** 
 * Piirt�� framen ruudulle.
 * @param GL10  OpenGL-konteksti
 * @param float X-koordinaatti
 * @param float Y-koordinaatti
 * @param int   Suunta
 * @param int   Kuvaruudun j�rjestysnumero
 */
public final void draw(GL10 _gl,float _x,float _y,int _direction,int _frame){
  _gl.glLoadIdentity();
  _gl.glTranslatef(_x,_y,0);
  _gl.glRotatef((float)_direction - 90.0f,0.0f,0.0f,1.0f);
  _gl.glBindTexture(GL10.GL_TEXTURE_2D,frames[_frame]);
  _gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  _gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  _gl.glFrontFace(GL10.GL_CW);
  _gl.glVertexPointer(3,GL10.GL_FLOAT,0,vertexBuffer);
  _gl.glTexCoordPointer(2,GL10.GL_FLOAT,0,textureBuffer);
  _gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,0,vertices.length / 3);
  _gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  _gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
}

Fixed version (ground truth):
/** 
 * Piirt�� framen ruudulle.
 * @param GL10  OpenGL-konteksti
 * @param float X-koordinaatti
 * @param float Y-koordinaatti
 * @param int   Suunta
 * @param int   Kuvaruudun j�rjestysnumero
 */
public final void draw(GL10 _gl,float _x,float _y,int _direction,int _frame){
  _gl.glLoadIdentity();
  _gl.glTranslatef(_x,_y,0);
  _gl.glRotatef((float)_direction - 90.0f,0.0f,0.0f,1.0f);
  _gl.glScalef(Options.scale,Options.scale,Options.scale);
  _gl.glBindTexture(GL10.GL_TEXTURE_2D,frames[_frame]);
  _gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  _gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  _gl.glFrontFace(GL10.GL_CW);
  _gl.glVertexPointer(3,GL10.GL_FLOAT,0,vertexBuffer);
  _gl.glTexCoordPointer(2,GL10.GL_FLOAT,0,textureBuffer);
  _gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,0,vertices.length / 3);
  _gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  _gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
}
Program: 20003
Project: 20003
Buggy source:
/** 
 * Alustaa luokan muuttujat.
 * @param int El�m�t/kest�vyys
 * @param int Puolustus
 * @param int Nopeus
 * @param int Hy�kk�ysvoima t�rm�tess� pelaajaan
 * @param int Taso
 */
public Enemy(int _health,int _defence,int _speed,int _attack,int _ai,int _rank){
  super();
  healthMax=_health;
  health=_health;
  attackMax=_attack;
  attack=_attack;
  speedMax=_speed;
  speed=_speed;
  defenceMax=_defence;
  defence=_defence;
  rank=_rank;
  if (rank == 1) {
    collisionRadius=20;
  }
 else   if (rank == 2) {
  }
  for (int i=0; i < 4; ++i) {
    if (GLRenderer.enemyAnimations[rank - 1][i] != null) {
      animationLength[i]=GLRenderer.enemyAnimations[rank - 1][i].length;
    }
  }
  wrapper=Wrapper.getInstance();
  listId=wrapper.addToList(this,Wrapper.CLASS_TYPE_ENEMY,1);
  if (_ai == 0) {
    priority=1;
    ai=new LinearAi(listId);
  }
}

Fixed version (ground truth):
/** 
 * Alustaa luokan muuttujat.
 * @param int El�m�t/kest�vyys
 * @param int Puolustus
 * @param int Nopeus
 * @param int Hy�kk�ysvoima t�rm�tess� pelaajaan
 * @param int Taso
 */
public Enemy(int _health,int _defence,int _speed,int _attack,int _ai,int _rank){
  super();
  healthMax=_health;
  health=_health;
  attackMax=_attack;
  attack=_attack;
  speedMax=_speed;
  speed=_speed;
  defenceMax=_defence;
  defence=_defence;
  rank=_rank;
  if (rank == 1) {
    collisionRadius=(int)(20 * Options.scale);
  }
 else   if (rank == 2) {
  }
  for (int i=0; i < 4; ++i) {
    if (GLRenderer.enemyAnimations[rank - 1][i] != null) {
      animationLength[i]=GLRenderer.enemyAnimations[rank - 1][i].length;
    }
  }
  wrapper=Wrapper.getInstance();
  listId=wrapper.addToList(this,Wrapper.CLASS_TYPE_ENEMY,1);
  if (_ai == 0) {
    priority=1;
    ai=new LinearAi(listId);
  }
}
Program: 20004
Project: 20004
Buggy source:
/** 
 * P�ivitt�� liikkumisen ja k��ntymisen.
 * @param long T�m�n hetkinen aika
 */
public void updateMovement(long _time){
  if (_time - movementTime >= movementDelay) {
    movementTime=_time;
    x+=Math.cos((direction * Math.PI) / 180) * movementSpeed;
    y+=Math.sin((direction * Math.PI) / 180) * movementSpeed;
    movementDelay-=movementAcceleration;
  }
  if (_time - turningTime >= turningDelay) {
    turningTime=_time;
    if (turningDirection == TO_THE_LEFT) {
      ++direction;
      if (direction == 360) {
        direction=0;
      }
    }
 else     if (turningDirection == TO_THE_RIGHT) {
      --direction;
      if (direction < 0) {
        direction=359;
      }
    }
    turningDelay-=turningAcceleration;
  }
}

Fixed version (ground truth):
/** 
 * P�ivitt�� liikkumisen ja k��ntymisen.
 * @param long T�m�n hetkinen aika
 */
public void updateMovement(long _time){
  if (_time - movementTime >= movementDelay) {
    movementTime=_time;
    x+=Math.cos((direction * Math.PI) / 180) * movementSpeed * Options.scale;
    y+=Math.sin((direction * Math.PI) / 180) * movementSpeed * Options.scale;
    movementDelay-=movementAcceleration;
  }
  if (_time - turningTime >= turningDelay) {
    turningTime=_time;
    if (turningDirection == TO_THE_LEFT) {
      ++direction;
      if (direction == 360) {
        direction=0;
      }
    }
 else     if (turningDirection == TO_THE_RIGHT) {
      --direction;
      if (direction < 0) {
        direction=359;
      }
    }
    turningDelay-=turningAcceleration;
  }
}
Program: 20006
Project: 20006
Buggy source:
/** 
 * Alustaa luokan muuttujat.
 * @param int Pelaajan el�m�t/kest�vyys
 * @param int Pelaajan puolustus
 */
public Player(int _health,int _defence){
  super();
  health=_health;
  defence=_defence;
  collisionRadius=25;
  for (int i=0; i < 4; ++i) {
    if (GLRenderer.playerAnimations[i] != null) {
      animationLength[i]=GLRenderer.playerAnimations[i].length;
    }
  }
  wrapper=Wrapper.getInstance();
  wrapper.addToList(this,Wrapper.CLASS_TYPE_PLAYER,1);
}

Fixed version (ground truth):
/** 
 * Alustaa luokan muuttujat.
 * @param int Pelaajan el�m�t/kest�vyys
 * @param int Pelaajan puolustus
 */
public Player(int _health,int _defence){
  super();
  health=_health;
  defence=_defence;
  collisionRadius=(int)(25 * Options.scale);
  for (int i=0; i < 4; ++i) {
    if (GLRenderer.playerAnimations[i] != null) {
      animationLength[i]=GLRenderer.playerAnimations[i].length;
    }
  }
  wrapper=Wrapper.getInstance();
  wrapper.addToList(this,Wrapper.CLASS_TYPE_PLAYER,1);
}
Program: 20008
Project: 20008
Buggy source:
/** 
 * Piirt�� tekstuurin ruudulle.
 * @param GL10  OpenGL-konteksti
 * @param float Tekstuurin X-koordinaatti
 * @param float Tekstuurin Y-koordinaatti
 * @param int   Tekstuurin suunta (0 = oikealle)
 */
public final void draw(GL10 _gl,float _x,float _y,int _direction){
  _gl.glLoadIdentity();
  _gl.glTranslatef(_x,_y,0);
  _gl.glRotatef((float)_direction - 90.0f,0.0f,0.0f,1.0f);
  _gl.glScalef(scale,scale,scale);
  _gl.glBindTexture(GL10.GL_TEXTURE_2D,sprite[0]);
  _gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  _gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  _gl.glFrontFace(GL10.GL_CW);
  _gl.glVertexPointer(3,GL10.GL_FLOAT,0,vertexBuffer);
  _gl.glTexCoordPointer(2,GL10.GL_FLOAT,0,textureBuffer);
  _gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,0,vertices.length / 3);
  _gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  _gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
}

Fixed version (ground truth):
/** 
 * Piirt�� tekstuurin ruudulle.
 * @param GL10  OpenGL-konteksti
 * @param float Tekstuurin X-koordinaatti
 * @param float Tekstuurin Y-koordinaatti
 * @param int   Tekstuurin suunta (0 = oikealle)
 */
public final void draw(GL10 _gl,float _x,float _y,int _direction){
  _gl.glLoadIdentity();
  _gl.glTranslatef(_x,_y,0);
  _gl.glRotatef((float)_direction - 90.0f,0.0f,0.0f,1.0f);
  _gl.glScalef(Options.scale,Options.scale,Options.scale);
  _gl.glBindTexture(GL10.GL_TEXTURE_2D,sprite[0]);
  _gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  _gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  _gl.glFrontFace(GL10.GL_CW);
  _gl.glVertexPointer(3,GL10.GL_FLOAT,0,vertexBuffer);
  _gl.glTexCoordPointer(2,GL10.GL_FLOAT,0,textureBuffer);
  _gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,0,vertices.length / 3);
  _gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  _gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
}
Program: 20010
Project: 20010
Buggy source:
public boolean onTouch(View v,MotionEvent event){
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    xClickOffset=(int)event.getX();
    yClickOffset=screenHeight - (int)event.getY();
    if (xClickOffset > screenWidth - 100 && xClickOffset < screenWidth) {
      if (yClickOffset < yClickFirstBorder && yClickOffset > 0) {
        hud.triggerClick(Hud.BUTTON_3);
      }
 else       if (yClickOffset < yClickSecondBorder && yClickOffset > 66) {
        hud.triggerClick(Hud.BUTTON_2);
      }
 else       if (yClickOffset < yClickThirdBorder && yClickOffset > 132) {
        hud.triggerClick(Hud.BUTTON_1);
      }
    }
 else     if (xClickOffset < 64 && xClickOffset > 0) {
      if (yClickOffset < yClickFirstBorder && yClickOffset > 0) {
        hud.triggerClick(Hud.SPECIAL_2);
      }
 else       if (yClickOffset < yClickSecondBorder && yClickOffset > 66) {
        hud.triggerClick(Hud.SPECIAL_1);
      }
    }
 else {
      weaponManager.triggerShoot(convertCoords((int)event.getX(),(int)event.getY()));
    }
    return true;
  }
  if (event.getAction() == MotionEvent.ACTION_UP) {
    if (Math.abs(event.getX() - xClickOffset) < touchMarginal && Math.abs(event.getY() - yClickOffset) < touchMarginal) {
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean onTouch(View v,MotionEvent event){
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    xClickOffset=(int)event.getX();
    yClickOffset=screenHeight - (int)event.getY();
    if (xClickOffset > screenWidth - 100 * Options.scale && xClickOffset < screenWidth) {
      if (yClickOffset < yClickFirstBorder * Options.scale && yClickOffset > 0) {
        hud.triggerClick(Hud.BUTTON_3);
      }
 else       if (yClickOffset < yClickSecondBorder * Options.scale && yClickOffset > 66 * Options.scale) {
        hud.triggerClick(Hud.BUTTON_2);
      }
 else       if (yClickOffset < yClickThirdBorder * Options.scale && yClickOffset > 132 * Options.scale) {
        hud.triggerClick(Hud.BUTTON_1);
      }
    }
 else     if (xClickOffset < 64 * Options.scale && xClickOffset > 0) {
      if (yClickOffset < yClickFirstBorder * Options.scale && yClickOffset > 0) {
        hud.triggerClick(Hud.SPECIAL_2);
      }
 else       if (yClickOffset < yClickSecondBorder * Options.scale && yClickOffset > 66 * Options.scale) {
        hud.triggerClick(Hud.SPECIAL_1);
      }
    }
 else {
      weaponManager.triggerShoot(convertCoords((int)event.getX(),(int)event.getY()));
    }
    return true;
  }
  if (event.getAction() == MotionEvent.ACTION_UP) {
    if (Math.abs(event.getX() - xClickOffset) < touchMarginal && Math.abs(event.getY() - yClickOffset) < touchMarginal) {
    }
    return true;
  }
  return false;
}
Program: 20011
Project: 20011
Buggy source:
/** 
 * Alustaa luokan muuttujat, lukee pelitilan tarvitsemat tiedot ja k�ynnist�� pelin.
 * @param DisplayMetrics N�yt�n tiedot
 * @param Context		 Ohjelman konteksti
 */
public SurvivalMode(DisplayMetrics _dm,Context _context){
  waves=new int[AMOUNT_OF_WAVES][AMOUNT_OF_ENEMIES_PER_WAVE];
  enemies=new ArrayList<Enemy>();
  enemyStats=new int[5][5];
  scoreCounter=new GuiObject();
  spawnPoints=new int[9][3][2];
  halfOfScreenWidth=_dm.widthPixels;
  halfOfScreenHeight=_dm.heightPixels;
  XmlReader reader=new XmlReader(_context);
  ArrayList<Integer> enemyStatsTemp=reader.readRanks();
  int rank=0;
  for (int i=0; i < enemyStatsTemp.size() - 1; ++i) {
    enemyStats[rank][i - rank * 5]=enemyStatsTemp.get(i);
    rank=(int)(i / 5);
  }
  reader.readSurvivalMode(this);
  weaponManager=new WeaponManager();
  weaponManager.initialize(WeaponManager.SURVIVAL_MODE);
  camera=CameraManager.getInstance();
  updateSpawnPoints();
  startWave();
}

Fixed version (ground truth):
/** 
 * Alustaa luokan muuttujat, lukee pelitilan tarvitsemat tiedot ja k�ynnist�� pelin.
 * @param DisplayMetrics N�yt�n tiedot
 * @param Context		 Ohjelman konteksti
 */
public SurvivalMode(DisplayMetrics _dm,Context _context){
  waves=new int[AMOUNT_OF_WAVES][AMOUNT_OF_ENEMIES_PER_WAVE];
  enemies=new ArrayList<Enemy>();
  enemyStats=new int[5][5];
  scoreCounter=new GuiObject();
  spawnPoints=new int[9][3][2];
  halfOfScreenWidth=_dm.widthPixels;
  halfOfScreenHeight=_dm.heightPixels;
  XmlReader reader=new XmlReader(_context);
  ArrayList<Integer> enemyStatsTemp=reader.readRanks();
  int rank=0;
  for (int i=0; i < enemyStatsTemp.size(); ++i) {
    rank=(int)(i / 5);
    enemyStats[rank][i - rank * 5]=enemyStatsTemp.get(i);
  }
  reader.readSurvivalMode(this);
  weaponManager=new WeaponManager();
  weaponManager.initialize(WeaponManager.SURVIVAL_MODE);
  camera=CameraManager.getInstance();
  updateSpawnPoints();
  startWave();
}
Program: 20012
Project: 20012
Buggy source:
/** 
 * Kutsutaan kun aktiviteetti luodaan. 
 */
@Override public void onCreate(Bundle _savedInstanceState){
  super.onCreate(_savedInstanceState);
  setContentView(R.layout.main);
  context=getApplicationContext();
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  View storyButton=findViewById(R.id.button_story);
  storyButton.setOnClickListener(this);
  View survivalButton=findViewById(R.id.button_survival);
  survivalButton.setOnClickListener(this);
  View helpButton=findViewById(R.id.button_help);
  helpButton.setOnClickListener(this);
  View highscoresButton=findViewById(R.id.button_highscores);
  highscoresButton.setOnClickListener(this);
  View optionsButton=findViewById(R.id.button_options);
  optionsButton.setOnClickListener(this);
  View quitButton=findViewById(R.id.button_quit);
  quitButton.setOnClickListener(this);
  SoundManager.getInstance();
  SoundManager.initSounds(this);
  SoundManager.loadSounds();
}

Fixed version (ground truth):
/** 
 * Kutsutaan kun aktiviteetti luodaan. 
 */
@Override public void onCreate(Bundle _savedInstanceState){
  super.onCreate(_savedInstanceState);
  setContentView(R.layout.main);
  context=getApplicationContext();
  Options options=Options.getInstance();
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  View storyButton=findViewById(R.id.button_story);
  storyButton.setOnClickListener(this);
  View survivalButton=findViewById(R.id.button_survival);
  survivalButton.setOnClickListener(this);
  View helpButton=findViewById(R.id.button_help);
  helpButton.setOnClickListener(this);
  View highscoresButton=findViewById(R.id.button_highscores);
  highscoresButton.setOnClickListener(this);
  View optionsButton=findViewById(R.id.button_options);
  optionsButton.setOnClickListener(this);
  View quitButton=findViewById(R.id.button_quit);
  quitButton.setOnClickListener(this);
  SoundManager.getInstance();
  SoundManager.initSounds(this);
}
Program: 20014
Project: 20014
Buggy source:
public boolean onPreferenceClick(Preference preference){
  particleState=((CheckBoxPreference)particlesPref).isChecked();
  musicState=((CheckBoxPreference)musicPref).isChecked();
  soundState=((CheckBoxPreference)soundsPref).isChecked();
  XmlWriter writer=new XmlWriter();
  writer.saveSettings(particleState,musicState,soundState);
  return true;
}

Fixed version (ground truth):
public boolean onPreferenceClick(Preference preference){
  particleState=((CheckBoxPreference)particlesPref).isChecked();
  musicState=((CheckBoxPreference)musicPref).isChecked();
  soundState=((CheckBoxPreference)soundsPref).isChecked();
  Options.sounds=((CheckBoxPreference)soundsPref).isChecked();
  writer.saveSettings(particleState,musicState,soundState);
  return true;
}
Program: 20015
Project: 20015
Buggy source:
public static final void initSounds(Context _context){
  context=_context;
  soundPool=new SoundPool(4,AudioManager.STREAM_MUSIC,0);
  soundPoolMap=new HashMap<Integer,Integer>();
  audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
}

Fixed version (ground truth):
public static final void initSounds(Context _context){
  context=_context;
  soundPool=new SoundPool(4,AudioManager.STREAM_MUSIC,0);
  soundPoolMap=new HashMap<Integer,Integer>();
  audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  loadSounds();
}
Program: 20016
Project: 20016
Buggy source:
public final boolean[] readSettings(){
  XmlResourceParser settings=null;
  boolean particles=false, music=false, sounds=false;
  settings=context.getResources().getXml(R.xml.settings);
  try {
    while (settings.getEventType() != XmlPullParser.END_DOCUMENT) {
      if (settings.getEventType() == XmlPullParser.START_TAG) {
        if (settings.getName().equals("String_Node_Str")) {
          if (settings.getAttributeValue(null,"String_Node_Str") == "String_Node_Str") {
            particles=true;
          }
 else           particles=false;
        }
 else         if (settings.getName().equals("String_Node_Str")) {
          if (settings.getAttributeValue(null,"String_Node_Str") == "String_Node_Str") {
            music=true;
          }
 else           music=false;
        }
 else         if (settings.getName().equals("String_Node_Str")) {
          if (settings.getAttributeValue(null,"String_Node_Str") == "String_Node_Str") {
            sounds=true;
          }
 else           sounds=false;
        }
      }
 else       if (settings.getEventType() == XmlPullParser.END_TAG) {
      }
    }
  }
 catch (  XmlPullParserException e) {
    e.printStackTrace();
  }
  boolean settingValues[]={particles,music,sounds};
  return settingValues;
}

Fixed version (ground truth):
public final boolean[] readSettings(){
  XmlResourceParser settings=null;
  boolean particles=false, music=false, sounds=false;
  settings=context.getResources().getXml(R.xml.settings);
  try {
    while (settings.getEventType() != XmlPullParser.END_DOCUMENT) {
      if (settings.getEventType() == XmlPullParser.START_TAG) {
        if (settings.getName().equals("String_Node_Str")) {
          if (settings.getAttributeValue(null,"String_Node_Str") == "String_Node_Str") {
            particles=true;
          }
 else           particles=false;
        }
 else         if (settings.getName().equals("String_Node_Str")) {
          if (settings.getAttributeValue(null,"String_Node_Str") == "String_Node_Str") {
            music=true;
          }
 else           music=false;
        }
 else         if (settings.getName().equals("String_Node_Str")) {
          if (settings.getAttributeValue(null,"String_Node_Str") == "String_Node_Str") {
            sounds=true;
          }
 else           sounds=false;
        }
      }
 else       if (settings.getEventType() == XmlPullParser.END_TAG) {
      }
      settings.next();
    }
  }
 catch (  XmlPullParserException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  boolean settingValues[]={particles,music,sounds};
  return settingValues;
}
Program: 20017
Project: 20017
Buggy source:
/** 
 * M��ritt�� asetukset ja luo tarvittavat oliot, kuten render�ij�n, HUDin, GameThreadin ja TouchManagerin.
 * @param Bundle Pelin aiempi tila
 */
@Override public void onCreate(Bundle _savedInstanceState){
  super.onCreate(_savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  surfaceView=new GLSurfaceView(this);
  renderer=new GLRenderer(this);
  surfaceView.setEGLConfigChooser(8,8,8,8,0,0);
  surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
  surfaceView.setRenderer(renderer);
  dm=new DisplayMetrics();
  getWindowManager().getDefaultDisplay().getMetrics(dm);
  setContentView(surfaceView);
  gameThread=new GameThread(dm,getBaseContext());
  renderer.connectToGameThread(gameThread);
  touchManager=new TouchManager(surfaceView,getBaseContext());
  hud=new HUD(getBaseContext());
}

Fixed version (ground truth):
/** 
 * M��ritt�� asetukset ja luo tarvittavat oliot, kuten render�ij�n, HUDin, GameThreadin ja TouchManagerin.
 * @param Bundle Pelin aiempi tila
 */
@Override public void onCreate(Bundle _savedInstanceState){
  super.onCreate(_savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  surfaceView=new GLSurfaceView(this);
  renderer=new GLRenderer(this);
  surfaceView.setEGLConfigChooser(8,8,8,8,0,0);
  surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
  surfaceView.setRenderer(renderer);
  dm=new DisplayMetrics();
  getWindowManager().getDefaultDisplay().getMetrics(dm);
  setContentView(surfaceView);
  gameThread=new GameThread(dm,getBaseContext());
  renderer.connectToGameThread(gameThread);
  hud=new HUD(getBaseContext());
  touchManager=new TouchManager(surfaceView,getBaseContext(),hud);
}