Program: 173638
Project: 173638
Buggy source:
/** 
 * Take the next step after a given one (see nextStep()) 
 */
protected void nextStep(GameDef.OrStep step){
  PublicCompanyI company=operatingCompany.get();
  int stepIndex;
  for (stepIndex=0; stepIndex < steps.length; stepIndex++) {
    if (steps[stepIndex] == step)     break;
  }
  while (++stepIndex < steps.length) {
    step=steps[stepIndex];
    log.debug("String_Node_Str" + step);
    if (step == GameDef.OrStep.LAY_TOKEN && company.getNumberOfFreeBaseTokens() == 0) {
      continue;
    }
    if (step == GameDef.OrStep.CALC_REVENUE) {
      if (!company.canRunTrains()) {
        executeSetRevenueAndDividend(new SetDividend(0,false,new int[]{SetDividend.NO_TRAIN}));
        continue;
      }
    }
    if (step == GameDef.OrStep.PAYOUT) {
      continue;
    }
    if (step == GameDef.OrStep.TRADE_SHARES) {
      if (!company.mayTradeShares() || !company.hasOperated()) {
        continue;
      }
      int ownShare=company.getPortfolio().getShare(company);
      int poolShare=pool.getShare(company);
      boolean canBuy=ownShare < getGameParameterAsInt(GameDef.Parm.TREASURY_SHARE_LIMIT) && company.getCash() >= company.getCurrentSpace().getPrice() && poolShare > 0;
      boolean canSell=company.getPortfolio().getShare(company) > 0 && poolShare < getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT);
      if (!canBuy && !canSell) {
        if (gameManager.isReloading()) {
          gameManager.setSkipDone();
          log.debug("String_Node_Str");
        }
        log.info("String_Node_Str");
        continue;
      }
      gameManager.startTreasuryShareTradingRound();
    }
    if (!gameSpecificNextStep(step))     continue;
    break;
  }
  if (step == GameDef.OrStep.FINAL) {
    finishTurn();
  }
 else {
    setStep(step);
  }
}

Fixed version (ground truth):
/** 
 * Take the next step after a given one (see nextStep()) 
 */
protected void nextStep(GameDef.OrStep step){
  PublicCompanyI company=operatingCompany.get();
  int stepIndex;
  for (stepIndex=0; stepIndex < steps.length; stepIndex++) {
    if (steps[stepIndex] == step)     break;
  }
  while (++stepIndex < steps.length) {
    step=steps[stepIndex];
    log.debug("String_Node_Str" + step);
    if (step == GameDef.OrStep.LAY_TOKEN && company.getNumberOfFreeBaseTokens() == 0) {
      continue;
    }
    if (step == GameDef.OrStep.CALC_REVENUE) {
      if (!company.canRunTrains()) {
        executeSetRevenueAndDividend(new SetDividend(0,false,new int[]{SetDividend.NO_TRAIN}));
        continue;
      }
    }
    if (step == GameDef.OrStep.PAYOUT) {
      continue;
    }
    if (step == GameDef.OrStep.TRADE_SHARES) {
      if (!company.mayTradeShares() || !company.hasOperated()) {
        continue;
      }
      int ownShare=company.getPortfolio().getShare(company);
      int poolShare=pool.getShare(company);
      boolean canBuy=ownShare < getGameParameterAsInt(GameDef.Parm.TREASURY_SHARE_LIMIT) && company.getCash() >= company.getCurrentSpace().getPrice() && poolShare > 0;
      boolean canSell=company.getPortfolio().getShare(company) > 0 && poolShare < getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT);
      if (!canBuy && !canSell) {
        if (gameManager.isReloading()) {
          gameManager.setSkipDone(GameDef.OrStep.TRADE_SHARES);
          log.debug("String_Node_Str");
        }
        log.info("String_Node_Str");
        continue;
      }
      gameManager.startTreasuryShareTradingRound();
    }
    if (!gameSpecificNextStep(step))     continue;
    break;
  }
  if (step == GameDef.OrStep.FINAL) {
    finishTurn();
  }
 else {
    setStep(step);
  }
}