Program: 173851
Project: 173851
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.
 */
public boolean startCompany(String playerName,String companyName,int price,int shares){
  String errMsg=null;
  StockSpaceI startSpace=null;
  int numberOfCertsToBuy=0;
  PublicCertificateI cert=null;
  PublicCompanyI company=null;
  currentPlayer=GameManager.getCurrentPlayer();
  while (true) {
    if (!playerName.equals(currentPlayer.getName())) {
      errMsg="String_Node_Str" + playerName;
      break;
    }
    if (companyBoughtThisTurn != null) {
      errMsg="String_Node_Str";
      break;
    }
    company=companyMgr.getPublicCompany(companyName);
    if (company == null) {
      errMsg="String_Node_Str";
      break;
    }
    if (company.hasStarted()) {
      errMsg=company.getName() + "String_Node_Str";
      break;
    }
    cert=ipo.findCertificate(company,true);
    if (shares < cert.getShares())     shares=cert.getShares();
    numberOfCertsToBuy=shares - (cert.getShares() - 1);
    if (!currentPlayer.mayBuyCertificates(numberOfCertsToBuy)) {
      errMsg="String_Node_Str";
      break;
    }
    startSpace=company.getParPrice();
    if (startSpace != null) {
      price=startSpace.getPrice();
    }
 else {
      if ((startSpace=stockMarket.getStartSpace(price)) == null) {
        errMsg="String_Node_Str" + price;
        break;
      }
    }
    if (currentPlayer.getCash() < shares * price) {
      errMsg="String_Node_Str";
      break;
    }
    break;
  }
  if (errMsg != null) {
    Log.error(playerName + "String_Node_Str" + companyName+ "String_Node_Str"+ errMsg);
    return false;
  }
  company.start(startSpace);
  currentPlayer.getPortfolio().buyCertificate(cert,ipo,cert.getCertificatePrice());
  for (int i=1; i < numberOfCertsToBuy; i++) {
    cert=ipo.findCertificate(company,false);
    currentPlayer.getPortfolio().buyCertificate(cert,ipo,cert.getCertificatePrice());
  }
  Log.write(playerName + "String_Node_Str" + companyName+ "String_Node_Str"+ price+ "String_Node_Str"+ shares+ "String_Node_Str"+ cert.getShare()+ "String_Node_Str"+ Bank.format(shares * price)+ "String_Node_Str");
  company.checkFlotation();
  companyBoughtThisTurn=company;
  hasPassed=false;
  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.
 */
public boolean startCompany(String playerName,String companyName,int price,int shares){
  String errMsg=null;
  StockSpaceI startSpace=null;
  int numberOfCertsToBuy=0;
  PublicCertificateI cert=null;
  PublicCompanyI company=null;
  currentPlayer=GameManager.getCurrentPlayer();
  while (true) {
    if (!playerName.equals(currentPlayer.getName())) {
      errMsg="String_Node_Str" + playerName;
      break;
    }
    if (companyBoughtThisTurn != null) {
      errMsg="String_Node_Str";
      break;
    }
    company=companyMgr.getPublicCompany(companyName);
    if (company == null) {
      errMsg="String_Node_Str";
      break;
    }
    if (company.hasStarted()) {
      errMsg=company.getName() + "String_Node_Str";
      break;
    }
    cert=ipo.findCertificate(company,true);
    if (shares < cert.getShares())     shares=cert.getShares();
    numberOfCertsToBuy=shares - (cert.getShares() - 1);
    if (!currentPlayer.mayBuyCertificate(company,numberOfCertsToBuy)) {
      errMsg="String_Node_Str";
      break;
    }
    startSpace=company.getParPrice();
    if (startSpace != null) {
      price=startSpace.getPrice();
    }
 else {
      if ((startSpace=stockMarket.getStartSpace(price)) == null) {
        errMsg="String_Node_Str" + price;
        break;
      }
    }
    if (currentPlayer.getCash() < shares * price) {
      errMsg="String_Node_Str";
      break;
    }
    break;
  }
  if (errMsg != null) {
    Log.error(playerName + "String_Node_Str" + companyName+ "String_Node_Str"+ errMsg);
    return false;
  }
  company.start(startSpace);
  currentPlayer.getPortfolio().buyCertificate(cert,ipo,cert.getCertificatePrice());
  for (int i=1; i < numberOfCertsToBuy; i++) {
    cert=ipo.findCertificate(company,false);
    currentPlayer.getPortfolio().buyCertificate(cert,ipo,cert.getCertificatePrice());
  }
  Log.write(playerName + "String_Node_Str" + companyName+ "String_Node_Str"+ price+ "String_Node_Str"+ shares+ "String_Node_Str"+ cert.getShare()+ "String_Node_Str"+ Bank.format(shares * price)+ "String_Node_Str");
  company.checkFlotation();
  companyBoughtThisTurn=company;
  hasPassed=false;
  setPriority();
  return true;
}