Program: 173515
Project: 173515
Buggy source:
/** 
 * Final initialisation, after all XML has been processed.
 */
public void finishConfiguration(GameManager gameManager) throws ConfigurationException {
  this.gameManager=gameManager;
  bank=gameManager.getBank();
  stockMarket=gameManager.getStockMarket();
  mapManager=gameManager.getMapManager();
  if (turnsWithExtraTileLaysInit != null) {
    turnsWithExtraTileLays=new HashMap<String,IntegerState>();
    for (    String colour : turnsWithExtraTileLaysInit.keySet()) {
      IntegerState tileLays=IntegerState.create(this,"String_Node_Str" + colour + "String_Node_Str",turnsWithExtraTileLaysInit.get(colour));
      turnsWithExtraTileLays.put(colour,tileLays);
    }
  }
  if (maxNumberOfLoans != 0) {
    currentNumberOfLoans=IntegerState.create(this,"String_Node_Str");
    currentLoanValue=CountingMoneyModel.create(this,"String_Node_Str",false);
    currentLoanValue.setSuppressZero(true);
  }
  if (hasStockPrice && Util.hasValue(startSpace)) {
    parPrice.setPrice(stockMarket.getStockSpace(startSpace));
    if (parPrice.getPrice() == null)     throw new ConfigurationException("String_Node_Str" + startSpace + "String_Node_Str"+ getId());
    currentPrice.setPrice(parPrice.getPrice());
  }
  if (shareUnit == null) {
    shareUnit=IntegerState.create(this,"String_Node_Str",DEFAULT_SHARE_UNIT);
  }
  int certIndex=0;
  if (certificateTags != null) {
    int shareTotal=0;
    boolean gotPresident=false;
    PublicCertificate certificate;
    for (    Tag certificateTag : certificateTags) {
      int shares=certificateTag.getAttributeAsInteger("String_Node_Str",1);
      boolean president="String_Node_Str".equals(certificateTag.getAttributeAsString("String_Node_Str","String_Node_Str"));
      int number=certificateTag.getAttributeAsInteger("String_Node_Str",1);
      boolean certIsInitiallyAvailable=certificateTag.getAttributeAsBoolean("String_Node_Str",certsAreInitiallyAvailable);
      float certificateCount=certificateTag.getAttributeAsFloat("String_Node_Str",1.0f);
      if (president) {
        if (number > 1 || gotPresident)         throw new ConfigurationException("String_Node_Str" + getId() + "String_Node_Str");
        gotPresident=true;
      }
      for (int k=0; k < number; k++) {
        certificate=new PublicCertificate(this,"String_Node_Str" + certIndex,shares,president,certIsInitiallyAvailable,certificateCount,certIndex++);
        certificates.add(certificate);
        shareTotal+=shares * shareUnit.value();
      }
    }
    if (shareTotal != 100)     throw new ConfigurationException("String_Node_Str" + getId() + "String_Node_Str");
  }
  nameCertificates();
  PublicCertificate cert;
  for (int i=0; i < certificates.size(); i++) {
    cert=certificates.get(i);
    cert.setUniqueId(getId(),i);
    cert.setInitiallyAvailable(cert.isInitiallyAvailable() && this.certsAreInitiallyAvailable);
  }
  Set<BaseToken> newTokens=Sets.newHashSet();
  for (int i=0; i < numberOfBaseTokens; i++) {
    BaseToken token=BaseToken.create(this);
    newTokens.add(token);
  }
  baseTokens.initTokens(newTokens);
  if (homeHexNames != null) {
    homeHexes=new ArrayList<MapHex>(2);
    MapHex homeHex;
    for (    String homeHexName : homeHexNames.split("String_Node_Str")) {
      homeHex=mapManager.getHex(homeHexName);
      if (homeHex == null) {
        throw new ConfigurationException("String_Node_Str" + homeHexName + "String_Node_Str"+ getId());
      }
      homeHexes.add(homeHex);
      infoText+="String_Node_Str" + homeHex.getInfo();
    }
  }
  if (destinationHexName != null) {
    destinationHex=mapManager.getHex(destinationHexName);
    if (destinationHex == null) {
      throw new ConfigurationException("String_Node_Str" + destinationHexName + "String_Node_Str"+ getId());
    }
    infoText+="String_Node_Str" + destinationHex.getInfo();
  }
  if (Util.hasValue(privateToCloseOnFirstTrainName)) {
    privateToCloseOnFirstTrain=gameManager.getCompanyManager().getPrivateCompany(privateToCloseOnFirstTrainName);
  }
  infoText+=parentInfoText;
  parentInfoText="String_Node_Str";
  if (portfolio.getSpecialProperties() != null) {
    for (    SpecialProperty sp : portfolio.getSpecialProperties()) {
      if (sp instanceof SpecialRight) {
        gameManager.setGuiParameter(GuiDef.Parm.HAS_ANY_RIGHTS,true);
        if (rights == null) {
          rights=HashMapState.create(this,"String_Node_Str");
        }
        sp.finishConfiguration(gameManager);
      }
    }
  }
  portfolio.finishConfiguration();
}

Fixed version (ground truth):
/** 
 * Final initialisation, after all XML has been processed.
 */
public void finishConfiguration(GameManager gameManager) throws ConfigurationException {
  this.gameManager=gameManager;
  bank=gameManager.getBank();
  stockMarket=gameManager.getStockMarket();
  mapManager=gameManager.getMapManager();
  if (turnsWithExtraTileLaysInit != null) {
    turnsWithExtraTileLays=new HashMap<String,IntegerState>();
    for (    String colour : turnsWithExtraTileLaysInit.keySet()) {
      IntegerState tileLays=IntegerState.create(this,"String_Node_Str" + colour + "String_Node_Str",turnsWithExtraTileLaysInit.get(colour));
      turnsWithExtraTileLays.put(colour,tileLays);
    }
  }
  if (maxNumberOfLoans != 0) {
    currentNumberOfLoans=IntegerState.create(this,"String_Node_Str");
    currentLoanValue=CountingMoneyModel.create(this,"String_Node_Str",false);
    currentLoanValue.setSuppressZero(true);
  }
  if (hasStockPrice && Util.hasValue(startSpace)) {
    parPrice.setPrice(stockMarket.getStockSpace(startSpace));
    if (parPrice.getPrice() == null)     throw new ConfigurationException("String_Node_Str" + startSpace + "String_Node_Str"+ getId());
    currentPrice.setPrice(parPrice.getPrice());
  }
  if (shareUnit == null) {
    shareUnit=IntegerState.create(this,"String_Node_Str",DEFAULT_SHARE_UNIT);
  }
  int certIndex=0;
  if (certificateTags != null) {
    int shareTotal=0;
    boolean gotPresident=false;
    PublicCertificate certificate;
    for (    Tag certificateTag : certificateTags) {
      int shares=certificateTag.getAttributeAsInteger("String_Node_Str",1);
      boolean president="String_Node_Str".equals(certificateTag.getAttributeAsString("String_Node_Str","String_Node_Str"));
      int number=certificateTag.getAttributeAsInteger("String_Node_Str",1);
      boolean certIsInitiallyAvailable=certificateTag.getAttributeAsBoolean("String_Node_Str",certsAreInitiallyAvailable);
      float certificateCount=certificateTag.getAttributeAsFloat("String_Node_Str",1.0f);
      if (president) {
        if (number > 1 || gotPresident)         throw new ConfigurationException("String_Node_Str" + getId() + "String_Node_Str");
        gotPresident=true;
      }
      for (int k=0; k < number; k++) {
        certificate=new PublicCertificate(this,"String_Node_Str" + certIndex,shares,president,certIsInitiallyAvailable,certificateCount,certIndex++);
        certificates.add(certificate);
        shareTotal+=shares * shareUnit.value();
      }
    }
    if (shareTotal != 100)     throw new ConfigurationException("String_Node_Str" + getId() + "String_Node_Str");
  }
  nameCertificates();
  PublicCertificate cert;
  for (int i=0; i < certificates.size(); i++) {
    cert=certificates.get(i);
    cert.setUniqueId(getId(),i);
    cert.setInitiallyAvailable(cert.isInitiallyAvailable() && this.certsAreInitiallyAvailable);
  }
  Set<BaseToken> newTokens=Sets.newHashSet();
  for (int i=0; i < numberOfBaseTokens; i++) {
    BaseToken token=BaseToken.create(this);
    newTokens.add(token);
  }
  baseTokens.initTokens(newTokens);
  if (homeHexNames != null) {
    homeHexes=new ArrayList<MapHex>(2);
    MapHex homeHex;
    for (    String homeHexName : homeHexNames.split("String_Node_Str")) {
      homeHex=mapManager.getHex(homeHexName);
      if (homeHex == null) {
        throw new ConfigurationException("String_Node_Str" + homeHexName + "String_Node_Str"+ getId());
      }
      homeHexes.add(homeHex);
      infoText+="String_Node_Str" + homeHex.getInfo();
    }
  }
  if (destinationHexName != null) {
    destinationHex=mapManager.getHex(destinationHexName);
    if (destinationHex == null) {
      throw new ConfigurationException("String_Node_Str" + destinationHexName + "String_Node_Str"+ getId());
    }
    infoText+="String_Node_Str" + destinationHex.getInfo();
  }
  if (Util.hasValue(privateToCloseOnFirstTrainName)) {
    privateToCloseOnFirstTrain=gameManager.getCompanyManager().getPrivateCompany(privateToCloseOnFirstTrainName);
  }
  infoText+=parentInfoText;
  parentInfoText="String_Node_Str";
  if (portfolio.hasSpecialProperties()) {
    for (    SpecialProperty sp : portfolio.getPersistentSpecialProperties()) {
      if (sp instanceof SpecialRight) {
        gameManager.setGuiParameter(GuiDef.Parm.HAS_ANY_RIGHTS,true);
        if (rights == null) {
          rights=HashMapState.create(this,"String_Node_Str");
        }
        sp.finishConfiguration(gameManager);
      }
    }
  }
  portfolio.finishConfiguration();
}