Program: 172374
Project: 172374
Buggy source:
public Player addNewPlayer(String name,int sex,int vocation,String accName,String channel){
  final int playerId=getNextPlayerId();
  final Player player=new Player();
  player.setPlayerId(playerId);
  player.setName(name);
  player.setAccName(accName);
  player.setSex(sex);
  player.setLev(1);
  player.setVocation(vocation);
  player.setRegTime(new Date());
  player.setServerId(SysConfig.serverId);
  player.setEnergyTime(System.currentTimeMillis());
  player.setRefresh(false);
  player.setChannel(channel);
  GlobalConfig globalParam=ConfigData.globalParam();
  player.setEnergy(globalParam.maxEnergy);
  player.setSceneId(globalParam.firstScene);
  player.setX(globalParam.defaultPos[0]);
  player.setY(globalParam.defaultPos[1]);
  player.setZ(globalParam.defaultPos[2]);
  players.put(playerId,player);
  try {
    playerDao.insert(player);
  }
 catch (  Exception e) {
    ServerLogger.err(e,"String_Node_Str");
    return null;
  }
  PlayerData playerData=initPlayerData(playerId,false);
  int fashionId=globalParam.fashionId[player.getVocation() - 1];
  player.setFashionId(fashionId);
  playerData.getFashions().add(fashionId);
  int weaponId=globalParam.weaponId[player.getVocation() - 1];
  player.setWeaponId(weaponId);
  playerData.getFashions().add(weaponId);
  int headId=globalParam.headId[player.getVocation() - 1];
  playerData.setCurHead(headId);
  playerData.getFashions().add(headId);
  playerData.setGroupTimes(ConfigData.globalParam().groupTimes);
  int[] skills=globalParam.playerDefaultSkill[player.getVocation() - 1];
  for (  int skill : skills) {
    playerData.getSkills().add(skill);
    playerData.getCurSkills().add(skill);
  }
  for (  Object object : ConfigData.getConfigs(ModuleOpenCfg.class)) {
    ModuleOpenCfg cfg=(ModuleOpenCfg)object;
    if (cfg.openType == 1) {
      playerData.getModules().add(cfg.id);
    }
  }
  playerData.setBlankGrids(globalParam.bagSize);
  taskService.initTask(playerId);
  goodsService.initBag(playerId);
  petService.initBag(playerId);
  playerCalculator.calculate(player);
  Context.getThreadService().execute(new Runnable(){
    @Override public void run(){
      updatePlayerData(playerId);
      update(player);
    }
  }
);
  return player;
}

Fixed version (ground truth):
public Player addNewPlayer(String name,int sex,int vocation,String accName,String channel){
  final int playerId=getNextPlayerId();
  final Player player=new Player();
  player.setPlayerId(playerId);
  player.setName(name);
  player.setAccName(accName);
  player.setSex(sex);
  player.setLev(1);
  player.setVocation(vocation);
  player.setRegTime(new Date());
  player.setServerId(SysConfig.serverId);
  player.setEnergyTime(System.currentTimeMillis());
  player.setRefresh(false);
  player.setChannel(channel);
  GlobalConfig globalParam=ConfigData.globalParam();
  player.setEnergy(globalParam.maxEnergy);
  player.setSceneId(globalParam.firstScene);
  player.setX(globalParam.defaultPos[0]);
  player.setY(globalParam.defaultPos[1]);
  player.setZ(globalParam.defaultPos[2]);
  players.put(playerId,player);
  try {
    playerDao.insert(player);
  }
 catch (  Exception e) {
    ServerLogger.err(e,"String_Node_Str");
    return null;
  }
  PlayerData playerData=initPlayerData(playerId,false);
  int fashionId=globalParam.fashionId[player.getVocation() - 1];
  player.setFashionId(fashionId);
  playerData.getFashions().add(fashionId);
  int weaponId=globalParam.weaponId[player.getVocation() - 1];
  player.setWeaponId(weaponId);
  playerData.getFashions().add(weaponId);
  int headId=globalParam.headId[player.getVocation() - 1];
  playerData.setCurHead(headId);
  playerData.getFashions().add(headId);
  playerData.setGroupTimes(ConfigData.globalParam().groupTimes);
  int[] skills=globalParam.playerDefaultSkill[player.getVocation() - 1];
  for (  int skill : skills) {
    playerData.getSkills().add(skill);
    playerData.getCurSkills().add(skill);
  }
  for (  int[] cardArr : globalParam.newbieskillCard) {
    addSkillCard(playerId,cardArr[0],cardArr[1]);
  }
  for (  Object object : ConfigData.getConfigs(ModuleOpenCfg.class)) {
    ModuleOpenCfg cfg=(ModuleOpenCfg)object;
    if (cfg.openType == 1) {
      playerData.getModules().add(cfg.id);
    }
  }
  playerData.setBlankGrids(globalParam.bagSize);
  taskService.initTask(playerId);
  goodsService.initBag(playerId);
  for (  int[] itemArr : globalParam.GuideEquip) {
    if (vocation == itemArr[0]) {
      goodsService.addGoodsToBag(playerId,itemArr[1],1,LogConsume.BAG_INIT);
      break;
    }
  }
  petService.initBag(playerId);
  playerCalculator.calculate(player);
  Context.getThreadService().execute(new Runnable(){
    @Override public void run(){
      updatePlayerData(playerId);
      update(player);
    }
  }
);
  return player;
}