Program: 173570
Project: 173570
Buggy source:
/** 
 * Take the next step after a given one (see nextStep()) 
 */
protected void nextStep(GameDef.OrStep step){
  PublicCompany company=operatingCompany.value();
  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.getPortfolioModel().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.getPortfolioModel().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);
  }
}

Fixed version (ground truth):
/** 
 * Take the next step after a given one (see nextStep()) 
 */
protected void nextStep(GameDef.OrStep step){
  PublicCompany company=operatingCompany.value();
  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) {
      log.debug("String_Node_Str" + step + "String_Node_Str");
      continue;
    }
    if (step == GameDef.OrStep.CALC_REVENUE) {
      if (!company.canRunTrains()) {
        log.debug("String_Node_Str" + step + "String_Node_Str");
        executeSetRevenueAndDividend(new SetDividend(0,false,new int[]{SetDividend.NO_TRAIN}));
        continue;
      }
    }
    if (step == GameDef.OrStep.PAYOUT) {
      log.debug("String_Node_Str" + step + "String_Node_Str");
      continue;
    }
    if (step == GameDef.OrStep.TRADE_SHARES) {
      if (!company.mayTradeShares() || !company.hasOperated()) {
        continue;
      }
      int ownShare=company.getPortfolioModel().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.getPortfolioModel().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)) {
      log.debug("String_Node_Str" + step + "String_Node_Str");
      continue;
    }
    break;
  }
  if (step == GameDef.OrStep.FINAL) {
    finishTurn();
  }
 else {
    setStep(step);
  }
}