Program: 173819
Project: 173819
Buggy source:
/** 
 * Start a company by buying one or more shares (more applies to e.g. 1841)
 * @param player The player that wants to start a company.
 * @param company The company to start.
 * @param price The start (par) price (ignored if the price is fixed).
 * @param shares The number of shares to buy (can be more than 1 in e.g. 1841).
 * @return True if the company could be started. False indicates an error.
 */
@Override public boolean startCompany(String playerName,StartCompany action){
  PublicCompanyI company=action.getCertificate().getCompany();
  int price=action.getPrice();
  int shares=action.getNumberBought();
  String errMsg=null;
  StockSpaceI startSpace=null;
  int numberOfCertsToBuy=0;
  PublicCertificateI cert=null;
  String companyName=company.getName();
  PublicCompanyI minor=null;
  StartCompany_18EU startAction=null;
  currentPlayer=GameManager.getCurrentPlayer();
  while (true) {
    if (!(action instanceof StartCompany_18EU)) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    startAction=(StartCompany_18EU)action;
    if (companyBoughtThisTurnWrapper.getObject() != null) {
      errMsg=LocalText.getText("String_Node_Str",playerName);
      break;
    }
    company=companyMgr.getPublicCompany(companyName);
    if (company == null) {
      errMsg=LocalText.getText("String_Node_Str",companyName);
      break;
    }
    if (company.hasStarted()) {
      errMsg=LocalText.getText("String_Node_Str",companyName);
      break;
    }
    cert=ipo.findCertificate(company,true);
    if (shares < cert.getShares())     shares=cert.getShares();
    numberOfCertsToBuy=shares - (cert.getShares() - 1);
    if (!currentPlayer.mayBuyCertificate(company,numberOfCertsToBuy)) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    startSpace=company.getParPrice();
    if (startSpace != null) {
      price=startSpace.getPrice();
    }
 else {
      if ((startSpace=stockMarket.getStartSpace(price)) == null) {
        errMsg=LocalText.getText("String_Node_Str",new String[]{Bank.format(price),company.getName()});
        break;
      }
    }
    if (currentPlayer.getCash() < shares * price) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    minor=startAction.getChosenMinor();
    if (currentPlayer.getPortfolio().getCertificatesPerCompany(minor.getName()) == null) {
      errMsg=LocalText.getText("String_Node_Str",new String[]{currentPlayer.getName(),minor.getName()});
      break;
    }
    numberOfCertsToBuy++;
    break;
  }
  if (errMsg != null) {
    DisplayBuffer.add(LocalText.getText("String_Node_Str",new String[]{playerName,companyName,Bank.format(price),errMsg}));
    return false;
  }
  MoveSet.start(true);
  company.setHomeHex(minor.getHomeHex());
  company.start(startSpace);
  int tokensCost=100;
  cert.moveTo(currentPlayer.getPortfolio());
  Bank.transferCash(currentPlayer,company,shares * price);
  Bank.transferCash(company,null,tokensCost);
  PublicCertificateI cert2=ipo.findCertificate(company,false);
  cert2.moveTo(currentPlayer.getPortfolio());
  Util.moveObjects(ipo.getCertificatesPerCompany(company.getName()),company.getPortfolio());
  int minorCash=minor.getCash();
  int minorTrains=minor.getPortfolio().getTrainList().size();
  company.transferAssetsFrom(minor);
  minor.setClosed();
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{playerName,companyName,Bank.format(price),Bank.format(shares * price),String.valueOf(shares),String.valueOf(cert.getShare()),company.getName()}));
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{currentPlayer.getName(),minor.getName(),company.getName(),Bank.format(minorCash),String.valueOf(minorTrains)}));
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{currentPlayer.getName(),String.valueOf(cert2.getShare()),company.getName(),minor.getName()}));
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{String.valueOf(company.getPortfolio().getShare(company)),company.getName()}));
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{company.getName(),Bank.format(100),String.valueOf(company.getNumberOfBaseTokens())}));
  companyBoughtThisTurnWrapper.set(company);
  hasActed.set(true);
  setPriority();
  return true;
}

Fixed version (ground truth):
/** 
 * Start a company by buying one or more shares (more applies to e.g. 1841)
 * @param player The player that wants to start a company.
 * @param company The company to start.
 * @param price The start (par) price (ignored if the price is fixed).
 * @param shares The number of shares to buy (can be more than 1 in e.g. 1841).
 * @return True if the company could be started. False indicates an error.
 */
@Override public boolean startCompany(String playerName,StartCompany action){
  PublicCompanyI company=action.getCertificate().getCompany();
  int price=action.getPrice();
  int shares=action.getNumberBought();
  String errMsg=null;
  StockSpaceI startSpace=null;
  int numberOfCertsToBuy=0;
  PublicCertificateI cert=null;
  String companyName=company.getName();
  PublicCompanyI minor=null;
  StartCompany_18EU startAction=null;
  currentPlayer=GameManager.getCurrentPlayer();
  while (true) {
    if (!(action instanceof StartCompany_18EU)) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    startAction=(StartCompany_18EU)action;
    if (companyBoughtThisTurnWrapper.getObject() != null) {
      errMsg=LocalText.getText("String_Node_Str",playerName);
      break;
    }
    company=companyMgr.getPublicCompany(companyName);
    if (company == null) {
      errMsg=LocalText.getText("String_Node_Str",companyName);
      break;
    }
    if (company.hasStarted()) {
      errMsg=LocalText.getText("String_Node_Str",companyName);
      break;
    }
    cert=ipo.findCertificate(company,true);
    if (shares < cert.getShares())     shares=cert.getShares();
    numberOfCertsToBuy=shares - (cert.getShares() - 1);
    if (!currentPlayer.mayBuyCertificate(company,numberOfCertsToBuy)) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    startSpace=company.getParPrice();
    if (startSpace != null) {
      price=startSpace.getPrice();
    }
 else {
      if ((startSpace=stockMarket.getStartSpace(price)) == null) {
        errMsg=LocalText.getText("String_Node_Str",new String[]{Bank.format(price),company.getName()});
        break;
      }
    }
    if (currentPlayer.getCash() < shares * price) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    minor=startAction.getChosenMinor();
    if (currentPlayer.getPortfolio().getCertificatesPerCompany(minor.getName()) == null) {
      errMsg=LocalText.getText("String_Node_Str",new String[]{currentPlayer.getName(),minor.getName()});
      break;
    }
    numberOfCertsToBuy++;
    break;
  }
  if (errMsg != null) {
    DisplayBuffer.add(LocalText.getText("String_Node_Str",new String[]{playerName,companyName,Bank.format(price),errMsg}));
    return false;
  }
  MoveSet.start(true);
  company.setHomeHex(minor.getHomeHex());
  company.start(startSpace);
  int tokensCost=100;
  cert.moveTo(currentPlayer.getPortfolio());
  new CashMove(currentPlayer,company,shares * price);
  new CashMove(company,null,tokensCost);
  PublicCertificateI cert2=ipo.findCertificate(company,false);
  cert2.moveTo(currentPlayer.getPortfolio());
  Util.moveObjects(ipo.getCertificatesPerCompany(company.getName()),company.getPortfolio());
  int minorCash=minor.getCash();
  int minorTrains=minor.getPortfolio().getTrainList().size();
  company.transferAssetsFrom(minor);
  minor.setClosed();
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{playerName,companyName,Bank.format(price),Bank.format(shares * price),String.valueOf(shares),String.valueOf(cert.getShare()),company.getName()}));
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{currentPlayer.getName(),minor.getName(),company.getName(),Bank.format(minorCash),String.valueOf(minorTrains)}));
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{currentPlayer.getName(),String.valueOf(cert2.getShare()),company.getName(),minor.getName()}));
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{String.valueOf(company.getPortfolio().getShare(company)),company.getName()}));
  ReportBuffer.add(LocalText.getText("String_Node_Str",new String[]{company.getName(),Bank.format(100),String.valueOf(company.getNumberOfBaseTokens())}));
  companyBoughtThisTurnWrapper.set(company);
  hasActed.set(true);
  setPriority();
  return true;
}