Program: 24623
Project: 24623
Buggy source:
/** 
 * Parses any actions requested by game client General format for "action" string TODO: to be reconsidered, check length? or ifs? "ACTION_NAME,PLAYER_NAME,VALUES..."
 * @param actions an array containing all actions from 1 client
 * @throws BadActionRequestException
 */
private void parseActions(String[] actions) throws BadActionRequestException {
  for (  String action : actions) {
    String[] tokens=action.split("String_Node_Str");
    String cmd=tokens[0];
    Player player=getPlayerByName(tokens[1]);
    if (player == null)     throw new BadActionRequestException("String_Node_Str" + tokens[1]);
    int value=0;
    try {
      value=Integer.parseInt(tokens[2]);
    }
 catch (    NumberFormatException e) {
      throw new BadActionRequestException("String_Node_Str" + tokens[2]);
    }
    int value2=0;
    if (tokens.length == 4) {
      try {
        value2=Integer.parseInt(tokens[3]);
      }
 catch (      NumberFormatException e) {
        throw new BadActionRequestException("String_Node_Str" + tokens[2]);
      }
    }
switch (cmd) {
case ATTR_UP:
      player.increaseAttr(value);
    break;
case SKILL_UP:
  player.increaseSkillLevel(value);
break;
case EQUIP:
GameItem item=player.getInventory().getItem(value);
if (item != null) {
if (item instanceof Weapon) {
player.equipWeapon((Weapon)item);
}
 else if (item instanceof Armor) {
player.equipArmor((Armor)item);
}
 else throw new BadActionRequestException("String_Node_Str" + value);
}
 else throw new BadActionRequestException("String_Node_Str" + value);
break;
case UNEQUIP:
player.unEquipItem(value);
break;
case REFINE:
GameItem itemToRefine=player.getInventory().getItem(value);
if (itemToRefine != null) {
if (itemToRefine instanceof EquippableItem) {
((EquippableItem)itemToRefine).refine();
}
 else throw new BadActionRequestException("String_Node_Str" + value);
}
 else throw new BadActionRequestException("String_Node_Str" + value);
break;
case ATTACK:
Enemy target=(Enemy)getGameCharacterByRuntimeID(value);
if (target != null && target.isAlive() && distanceBetween(player,target) <= ((Weapon)player.getEquip(Player.RIGHT_HAND)).range) {
if (++player.atkTime >= ATK_INTERVAL / (1 + player.getTotalStat(GameCharacter.ASPD) / 100.0)) {
int dmg=player.attack(target);
animations.add(new Animation(player.getX(),player.getY(),0.5f,0,25,dmg + "String_Node_Str"));
player.atkTime=0;
if (target.getHP() <= 0) {
player.gainBaseExperience(target.experience);
player.gainJobExperience(target.experience);
player.gainStatExperience(target.experience);
chests.add(target.onDeath());
}
}
if (++target.atkTime >= ATK_INTERVAL / (1 + target.getTotalStat(GameCharacter.ASPD) / 100.0)) {
int dmg=target.attack(player);
animations.add(new Animation(player.getX(),player.getY() + 80,0.5f,0,25,dmg + "String_Node_Str"));
target.atkTime=0;
if (player.getHP() <= 0) {
}
}
}
break;
case SKILL_USE:
Enemy skTarget=(Enemy)getGameCharacterByRuntimeID(value2);
if (skTarget != null) {
player.useSkill(value,skTarget);
if (skTarget.getHP() <= 0) {
player.gainBaseExperience(skTarget.experience);
player.gainJobExperience(skTarget.experience);
player.gainStatExperience(skTarget.experience);
chests.add(skTarget.onDeath());
}
}
break;
case USE_ITEM:
UsableItem itemToUse=(UsableItem)player.getInventory().getItem(value);
itemToUse.onUse(player);
break;
case CHAT:
animations.add(new Animation(player.getX(),player.getY(),2.0f,0,0,tokens[4]));
break;
default :
throw new BadActionRequestException("String_Node_Str" + tokens[0]);
}
}
}

Fixed version (ground truth):
/** 
 * Parses any actions requested by game client General format for "action" string TODO: to be reconsidered, check length? or ifs? "ACTION_NAME,PLAYER_NAME,VALUES..."
 * @param actions an array containing all actions from 1 client
 * @throws BadActionRequestException
 */
private void parseActions(String[] actions) throws BadActionRequestException {
  for (  String action : actions) {
    String[] tokens=action.split("String_Node_Str");
    String cmd=tokens[0];
    Player player=getPlayerByName(tokens[1]);
    if (player == null)     throw new BadActionRequestException("String_Node_Str" + tokens[1]);
    int value=0;
    try {
      value=Integer.parseInt(tokens[2]);
    }
 catch (    NumberFormatException e) {
      throw new BadActionRequestException("String_Node_Str" + tokens[2]);
    }
    int value2=0;
    if (tokens.length == 4) {
      try {
        value2=Integer.parseInt(tokens[3]);
      }
 catch (      NumberFormatException e) {
        throw new BadActionRequestException("String_Node_Str" + tokens[2]);
      }
    }
switch (cmd) {
case ATTR_UP:
      player.increaseAttr(value);
    break;
case SKILL_UP:
  player.increaseSkillLevel(value);
break;
case EQUIP:
GameItem item=player.getInventory().getItem(value);
if (item != null) {
if (item instanceof Weapon) {
player.equipWeapon((Weapon)item);
}
 else if (item instanceof Armor) {
player.equipArmor((Armor)item);
}
 else throw new BadActionRequestException("String_Node_Str" + value);
}
 else throw new BadActionRequestException("String_Node_Str" + value);
break;
case UNEQUIP:
player.unEquipItem(value);
break;
case REFINE:
GameItem itemToRefine=player.getInventory().getItem(value);
if (itemToRefine != null) {
if (itemToRefine instanceof EquippableItem) {
((EquippableItem)itemToRefine).refine();
}
 else throw new BadActionRequestException("String_Node_Str" + value);
}
 else throw new BadActionRequestException("String_Node_Str" + value);
break;
case ATTACK:
Enemy target=(Enemy)getGameCharacterByRuntimeID(value);
if (target != null && target.isAlive() && distanceBetween(player,target) <= ((Weapon)player.getEquip(Player.RIGHT_HAND)).range) {
if (++player.atkTime >= ATK_INTERVAL / (1 + player.getTotalStat(GameCharacter.ASPD) / 100.0)) {
int dmg=player.attack(target);
animations.add(new Animation(player.getX(),player.getY(),0.5f,0,25,dmg + "String_Node_Str"));
player.atkTime=0;
if (target.getHP() <= 0) {
player.gainBaseExperience(target.experience);
player.gainJobExperience(target.experience);
player.gainStatExperience(target.experience);
chests.add(target.onDeath());
}
}
}
break;
case SKILL_USE:
Enemy skTarget=(Enemy)getGameCharacterByRuntimeID(value2);
if (skTarget != null) {
player.useSkill(value,skTarget);
if (skTarget.getHP() <= 0) {
player.gainBaseExperience(skTarget.experience);
player.gainJobExperience(skTarget.experience);
player.gainStatExperience(skTarget.experience);
chests.add(skTarget.onDeath());
}
}
break;
case USE_ITEM:
UsableItem itemToUse=(UsableItem)player.getInventory().getItem(value);
itemToUse.onUse(player);
break;
case CHAT:
animations.add(new Animation(player.getX(),player.getY(),2.0f,0,0,tokens[4]));
break;
default :
throw new BadActionRequestException("String_Node_Str" + tokens[0]);
}
}
}