Program: 167228
Project: 167228
Buggy source:
/** 
 * Builds report on words in ConLang. Potentially computationally expensive.
 * @return 
 */
public String buildWordReport(){
  String ret="String_Node_Str";
  String conFontTag="String_Node_Str" + core.getLangFont().getFontName() + "String_Node_Str";
  Map<String,Integer> wordStart=new HashMap<String,Integer>();
  Map<String,Integer> wordEnd=new HashMap<String,Integer>();
  Map<String,Integer> characterCombos2=new HashMap<String,Integer>();
  Integer highestCombo2=0;
  Map<String,Integer> characterCombos3=new HashMap<String,Integer>();
  Map<String,Integer> typeCountByWord=new HashMap<String,Integer>();
  Map<String,Integer> phonemeCount=new HashMap<String,Integer>();
  Map<String,Integer> charCount=new HashMap<String,Integer>();
  Map<String,Integer> phonemeCombo2=new HashMap<String,Integer>();
  Integer wordCount=nodeMap.size();
  Iterator<ConWord> wordIt=new ArrayList<ConWord>(nodeMap.values()).iterator();
  while (wordIt.hasNext()) {
    ConWord curWord=wordIt.next();
    final String curValue=curWord.getValue();
    final int curValueLength=curValue.length();
    final String curType=curWord.getWordType();
    String beginsWith=curValue.substring(0,1);
    String endsWith=curValue.substring(curValueLength - 1,curValueLength);
    if (wordStart.containsKey(beginsWith)) {
      wordStart.replace(beginsWith,wordStart.get(beginsWith) + 1);
    }
 else {
      wordStart.put(beginsWith,1);
    }
    if (wordEnd.containsKey(endsWith)) {
      wordEnd.replace(endsWith,wordEnd.get(endsWith) + 1);
    }
 else {
      wordEnd.put(endsWith,1);
    }
    List<PronunciationNode> phonArray=core.getPronunciationElements(curValue);
    for (int i=0; i < phonArray.size(); i++) {
      if (phonemeCount.containsKey(phonArray.get(i).getPronunciation())) {
        phonemeCount.replace(phonArray.get(i).getPronunciation(),phonemeCount.get(phonArray.get(i).getPronunciation()) + 1);
      }
 else {
        phonemeCount.put(phonArray.get(i).getPronunciation(),1);
      }
      if (i + 1 < phonArray.size()) {
        String curCombo=phonArray.get(i).getPronunciation() + "String_Node_Str" + phonArray.get(i + 1).getPronunciation();
        if (phonemeCombo2.containsKey(curCombo)) {
          phonemeCombo2.replace(curCombo,phonemeCombo2.get(curCombo) + 1);
        }
 else {
          phonemeCombo2.put(curCombo,1);
        }
      }
    }
    for (int i=0; i < curValueLength; i++) {
      String curChar=curValue.substring(i,i + 1);
      if (charCount.containsKey(curChar)) {
        charCount.replace(curChar,charCount.get(curChar) + 1);
      }
 else {
        charCount.put(curChar,1);
      }
    }
    for (int i=0; i < curValueLength - 1; i++) {
      String combo=curValue.substring(i,i + 2);
      if (characterCombos2.containsKey(combo)) {
        int curComboCount=characterCombos2.get(combo);
        if (highestCombo2 <= curComboCount) {
          highestCombo2=curComboCount + 1;
        }
        characterCombos2.replace(combo,curComboCount + 1);
      }
 else {
        characterCombos2.put(combo,1);
      }
    }
    for (int i=0; i < curValueLength - 2; i++) {
      String combo=curValue.substring(i,i + 3);
      if (characterCombos3.containsKey(combo)) {
        characterCombos3.replace(combo,characterCombos3.get(combo) + 1);
      }
 else {
        characterCombos3.put(combo,1);
      }
    }
    if (typeCountByWord.containsKey(curType)) {
      typeCountByWord.replace(curType,typeCountByWord.get(curType) + 1);
    }
 else {
      typeCountByWord.put(curType,1);
    }
  }
  ret+="String_Node_Str" + wordCount + "String_Node_Str";
  ret+="String_Node_Str";
  for (  Entry<String,Integer> curEntry : typeCountByWord.entrySet()) {
    ret+=curEntry.getKey() + "String_Node_Str" + curEntry.getValue()+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  for (  char letter : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ letter+ "String_Node_Str"+ (wordStart.containsKey("String_Node_Str" + letter) ? wordStart.get("String_Node_Str" + letter) : "String_Node_Str")+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  for (  char letter : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ letter+ "String_Node_Str"+ (wordEnd.containsKey("String_Node_Str" + letter) ? wordEnd.get("String_Node_Str" + letter) : "String_Node_Str")+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  for (  char letter : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ letter+ "String_Node_Str"+ (charCount.containsKey("String_Node_Str" + letter) ? charCount.get("String_Node_Str" + letter) : "String_Node_Str")+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  Iterator<PronunciationNode> procLoop=core.getPronunciations();
  while (procLoop.hasNext()) {
    PronunciationNode curNode=procLoop.next();
    ret+=curNode.getPronunciation() + "String_Node_Str" + (phonemeCount.containsKey(curNode.getPronunciation()) ? phonemeCount.get(curNode.getPronunciation()) : "String_Node_Str")+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  for (  char topRow : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ topRow+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  for (  char y : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ y+ "String_Node_Str";
    for (    char x : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
      String search="String_Node_Str" + x + y;
      Integer comboValue=(characterCombos2.containsKey(search) ? characterCombos2.get(search) : 0);
      Integer red=(255 / highestCombo2) * comboValue;
      Integer blue=255 - red;
      ret+="String_Node_Str" + red + "String_Node_Str"+ blue+ "String_Node_Str"+ blue+ "String_Node_Str"+ "String_Node_Str"+ conFontTag+ "String_Node_Str"+ x+ y+ "String_Node_Str"+ "String_Node_Str"+ comboValue.toString()+ "String_Node_Str";
    }
    ret+="String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  Iterator<PronunciationNode> procIty=core.getPronunciations();
  while (procIty.hasNext()) {
    ret+="String_Node_Str" + procIty.next().getPronunciation() + "String_Node_Str";
  }
  ret+="String_Node_Str";
  procIty=core.getPronunciations();
  while (procIty.hasNext()) {
    PronunciationNode y=procIty.next();
    ret+="String_Node_Str" + y.getPronunciation() + "String_Node_Str";
    Iterator<PronunciationNode> procItx=core.getPronunciations();
    while (procItx.hasNext()) {
      PronunciationNode x=procItx.next();
      String search=x.getPronunciation() + "String_Node_Str" + y.getPronunciation();
      Integer comboValue=(phonemeCombo2.containsKey(search) ? phonemeCombo2.get(search) : 0);
      Integer red=(255 / highestCombo2) * comboValue;
      Integer blue=255 - red;
      ret+="String_Node_Str" + red + "String_Node_Str"+ blue+ "String_Node_Str"+ blue+ "String_Node_Str"+ x.getPronunciation()+ y.getPronunciation()+ "String_Node_Str"+ comboValue.toString()+ "String_Node_Str";
    }
    ret+="String_Node_Str";
  }
  ret+="String_Node_Str";
  return ret;
}

Fixed version (ground truth):
/** 
 * Builds report on words in ConLang. Potentially computationally expensive.
 * @return 
 */
public String buildWordReport(){
  String ret="String_Node_Str";
  String conFontTag="String_Node_Str" + core.getLangFont().getFontName() + "String_Node_Str";
  Map<String,Integer> wordStart=new HashMap<String,Integer>();
  Map<String,Integer> wordEnd=new HashMap<String,Integer>();
  Map<String,Integer> characterCombos2=new HashMap<String,Integer>();
  Integer highestCombo2=0;
  Map<String,Integer> characterCombos3=new HashMap<String,Integer>();
  Map<String,Integer> typeCountByWord=new HashMap<String,Integer>();
  Map<String,Integer> phonemeCount=new HashMap<String,Integer>();
  Map<String,Integer> charCount=new HashMap<String,Integer>();
  Map<String,Integer> phonemeCombo2=new HashMap<String,Integer>();
  Integer wordCount=nodeMap.size();
  Iterator<ConWord> wordIt=new ArrayList<ConWord>(nodeMap.values()).iterator();
  while (wordIt.hasNext()) {
    ConWord curWord=wordIt.next();
    final String curValue=curWord.getValue();
    final int curValueLength=curValue.length();
    final String curType=curWord.getWordType();
    String beginsWith=curValue.substring(0,1);
    String endsWith=curValue.substring(curValueLength - 1,curValueLength);
    if (wordStart.containsKey(beginsWith)) {
      int newValue=wordStart.get(beginsWith) + 1;
      wordStart.remove(beginsWith);
      wordStart.put(beginsWith,newValue);
    }
 else {
      wordStart.put(beginsWith,1);
    }
    if (wordEnd.containsKey(endsWith)) {
      int newValue=wordEnd.get(endsWith) + 1;
      wordEnd.remove(endsWith);
      wordEnd.put(endsWith,newValue);
    }
 else {
      wordEnd.put(endsWith,1);
    }
    List<PronunciationNode> phonArray=core.getPronunciationElements(curValue);
    for (int i=0; i < phonArray.size(); i++) {
      if (phonemeCount.containsKey(phonArray.get(i).getPronunciation())) {
        int newValue=phonemeCount.get(phonArray.get(i).getPronunciation()) + 1;
        phonemeCount.remove(phonArray.get(i).getPronunciation());
        phonemeCount.put(phonArray.get(i).getPronunciation(),newValue);
      }
 else {
        phonemeCount.put(phonArray.get(i).getPronunciation(),1);
      }
      if (i + 1 < phonArray.size()) {
        String curCombo=phonArray.get(i).getPronunciation() + "String_Node_Str" + phonArray.get(i + 1).getPronunciation();
        if (phonemeCombo2.containsKey(curCombo)) {
          int newValue=phonemeCombo2.get(curCombo) + 1;
          phonemeCombo2.remove(curCombo);
          phonemeCombo2.put(curCombo,newValue);
        }
 else {
          phonemeCombo2.put(curCombo,1);
        }
      }
    }
    for (int i=0; i < curValueLength; i++) {
      String curChar=curValue.substring(i,i + 1);
      if (charCount.containsKey(curChar)) {
        int newValue=charCount.get(curChar) + 1;
        charCount.remove(curChar);
        charCount.put(curChar,newValue);
      }
 else {
        charCount.put(curChar,1);
      }
    }
    for (int i=0; i < curValueLength - 1; i++) {
      String combo=curValue.substring(i,i + 2);
      if (characterCombos2.containsKey(combo)) {
        int curComboCount=characterCombos2.get(combo);
        if (highestCombo2 <= curComboCount) {
          highestCombo2=curComboCount + 1;
        }
        int newValue=characterCombos2.get(combo) + 1;
        characterCombos2.remove(combo);
        characterCombos2.put(combo,newValue);
      }
 else {
        characterCombos2.put(combo,1);
      }
    }
    for (int i=0; i < curValueLength - 2; i++) {
      String combo=curValue.substring(i,i + 3);
      if (characterCombos3.containsKey(combo)) {
        int newValue=characterCombos3.get(combo) + 1;
        characterCombos3.remove(combo);
        characterCombos3.put(combo,newValue);
      }
 else {
        characterCombos3.put(combo,1);
      }
    }
    if (typeCountByWord.containsKey(curType)) {
      int newValue=typeCountByWord.get(curType) + 1;
      typeCountByWord.remove(curType);
      typeCountByWord.put(curType,newValue);
    }
 else {
      typeCountByWord.put(curType,1);
    }
  }
  ret+="String_Node_Str" + wordCount + "String_Node_Str";
  ret+="String_Node_Str";
  for (  Entry<String,Integer> curEntry : typeCountByWord.entrySet()) {
    ret+=curEntry.getKey() + "String_Node_Str" + curEntry.getValue()+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  for (  char letter : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ letter+ "String_Node_Str"+ (wordStart.containsKey("String_Node_Str" + letter) ? wordStart.get("String_Node_Str" + letter) : "String_Node_Str")+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  for (  char letter : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ letter+ "String_Node_Str"+ (wordEnd.containsKey("String_Node_Str" + letter) ? wordEnd.get("String_Node_Str" + letter) : "String_Node_Str")+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  for (  char letter : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ letter+ "String_Node_Str"+ (charCount.containsKey("String_Node_Str" + letter) ? charCount.get("String_Node_Str" + letter) : "String_Node_Str")+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  Iterator<PronunciationNode> procLoop=core.getPronunciations();
  while (procLoop.hasNext()) {
    PronunciationNode curNode=procLoop.next();
    ret+=curNode.getPronunciation() + "String_Node_Str" + (phonemeCount.containsKey(curNode.getPronunciation()) ? phonemeCount.get(curNode.getPronunciation()) : "String_Node_Str")+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  for (  char topRow : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ topRow+ "String_Node_Str";
  }
  ret+="String_Node_Str";
  for (  char y : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
    ret+="String_Node_Str" + conFontTag + "String_Node_Str"+ y+ "String_Node_Str";
    for (    char x : core.getPropertiesManager().getAlphaPlainText().toCharArray()) {
      String search="String_Node_Str" + x + y;
      Integer comboValue=(characterCombos2.containsKey(search) ? characterCombos2.get(search) : 0);
      Integer red=(255 / highestCombo2) * comboValue;
      Integer blue=255 - red;
      ret+="String_Node_Str" + red + "String_Node_Str"+ blue+ "String_Node_Str"+ blue+ "String_Node_Str"+ "String_Node_Str"+ conFontTag+ "String_Node_Str"+ x+ y+ "String_Node_Str"+ "String_Node_Str"+ comboValue.toString()+ "String_Node_Str";
    }
    ret+="String_Node_Str";
  }
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  ret+="String_Node_Str";
  Iterator<PronunciationNode> procIty=core.getPronunciations();
  while (procIty.hasNext()) {
    ret+="String_Node_Str" + procIty.next().getPronunciation() + "String_Node_Str";
  }
  ret+="String_Node_Str";
  procIty=core.getPronunciations();
  while (procIty.hasNext()) {
    PronunciationNode y=procIty.next();
    ret+="String_Node_Str" + y.getPronunciation() + "String_Node_Str";
    Iterator<PronunciationNode> procItx=core.getPronunciations();
    while (procItx.hasNext()) {
      PronunciationNode x=procItx.next();
      String search=x.getPronunciation() + "String_Node_Str" + y.getPronunciation();
      Integer comboValue=(phonemeCombo2.containsKey(search) ? phonemeCombo2.get(search) : 0);
      Integer red=(255 / highestCombo2) * comboValue;
      Integer blue=255 - red;
      ret+="String_Node_Str" + red + "String_Node_Str"+ blue+ "String_Node_Str"+ blue+ "String_Node_Str"+ x.getPronunciation()+ y.getPronunciation()+ "String_Node_Str"+ comboValue.toString()+ "String_Node_Str";
    }
    ret+="String_Node_Str";
  }
  ret+="String_Node_Str";
  return ret;
}