Program: 44164
Project: 44164
Buggy source:
public void GenerateKML() throws IOException, ImportException, ParseException, RuntimeException, OutOfMemoryError {
  time=-System.currentTimeMillis();
  mrsd=new ThreadLocalSpreadDate(mrsdString);
switch (analysisType) {
case 1:
    tree=(RootedTree)treeImporter.importNextTree();
  treeRootHeight=Utils.getNodeHeight(tree,tree.getRootNode());
sliceHeights=generateTreeSliceHeights(treeRootHeight,numberOfIntervals);
timeLine=generateTreeTimeLine(tree);
break;
case 2:
timeLine=generateCustomTimeLine(sliceHeights);
break;
}
System.out.println("String_Node_Str");
Utils.printArray(sliceHeights);
System.out.println();
layers=new ArrayList<Layer>();
int NTHREDS=Runtime.getRuntime().availableProcessors();
ExecutorService executor=Executors.newFixedThreadPool(NTHREDS * 2);
int treesAssumed=10000;
int treesRead=0;
System.out.println("String_Node_Str");
System.out.println("String_Node_Str");
System.out.println("String_Node_Str");
int stepSize=treesAssumed / 60;
if (stepSize < 1) {
stepSize=1;
}
slicesMap=new ConcurrentHashMap<Double,List<Coordinates>>();
int totalTrees=0;
while (treesImporter.hasTree()) {
currentTree=(RootedTree)treesImporter.importNextTree();
if (totalTrees >= burnIn) {
executor.submit(new AnalyzeTree(currentTree,precisionString,coordinatesName,rateString,sliceHeights,timescaler,mrsd,slicesMap,useTrueNoise));
treesRead+=1;
}
if (totalTrees > 0 && totalTrees % stepSize == 0) {
System.out.print("String_Node_Str");
System.out.flush();
}
totalTrees++;
}
if ((totalTrees - burnIn) <= 0.0) {
throw new RuntimeException("String_Node_Str");
}
 else {
System.out.println("String_Node_Str" + treesRead + "String_Node_Str"+ burnIn+ "String_Node_Str"+ totalTrees+ "String_Node_Str");
}
executor.shutdown();
while (!executor.isTerminated()) {
}
System.out.println("String_Node_Str");
Iterator<Double> iterator=slicesMap.keySet().iterator();
executor=Executors.newFixedThreadPool(NTHREDS);
formatter=new SimpleDateFormat("String_Node_Str",Locale.US);
startTime=timeLine.getStartTime();
endTime=timeLine.getEndTime();
System.out.println("String_Node_Str");
int polygonsStyleId=1;
while (iterator.hasNext()) {
System.out.println("String_Node_Str" + polygonsStyleId + "String_Node_Str");
Double sliceTime=iterator.next();
new Polygons(sliceTime,polygonsStyleId).run();
polygonsStyleId++;
}
switch (analysisType) {
case 1:
System.out.println("String_Node_Str");
executor.submit(new Branches());
break;
case 2:
break;
}
executor.shutdown();
while (!executor.isTerminated()) {
}
System.out.println("String_Node_Str");
PrintWriter writer=new PrintWriter(kmlPath);
KMLGenerator kmloutput=new KMLGenerator();
kmloutput.generate(writer,timeLine,layers);
time+=System.currentTimeMillis();
}

Fixed version (ground truth):
public void GenerateKML() throws IOException, ImportException, ParseException, RuntimeException, OutOfMemoryError {
  time=-System.currentTimeMillis();
  mrsd=new ThreadLocalSpreadDate(mrsdString);
switch (analysisType) {
case FIRST_ANALYSIS:
    tree=(RootedTree)treeImporter.importNextTree();
  treeRootHeight=Utils.getNodeHeight(tree,tree.getRootNode());
sliceHeights=generateTreeSliceHeights(treeRootHeight,numberOfIntervals);
timeLine=generateTreeTimeLine(tree);
break;
case SECOND_ANALYSIS:
timeLine=generateCustomTimeLine(sliceHeights);
break;
}
System.out.println("String_Node_Str");
Utils.printArray(sliceHeights);
System.out.println();
layers=new ArrayList<Layer>();
int NTHREDS=Runtime.getRuntime().availableProcessors();
ExecutorService executor=Executors.newFixedThreadPool(NTHREDS * 2);
int treesAssumed=10000;
int treesRead=0;
System.out.println("String_Node_Str");
System.out.println("String_Node_Str");
System.out.println("String_Node_Str");
int stepSize=treesAssumed / 60;
if (stepSize < 1) {
stepSize=1;
}
slicesMap=new ConcurrentHashMap<Double,List<Coordinates>>();
int totalTrees=0;
while (treesImporter.hasTree()) {
currentTree=(RootedTree)treesImporter.importNextTree();
if (totalTrees >= burnIn) {
executor.submit(new AnalyzeTree(currentTree,precisionString,coordinatesName,rateString,sliceHeights,timescaler,mrsd,slicesMap,useTrueNoise));
treesRead+=1;
}
if (totalTrees > 0 && totalTrees % stepSize == 0) {
System.out.print("String_Node_Str");
System.out.flush();
}
totalTrees++;
}
if ((totalTrees - burnIn) <= 0.0) {
throw new RuntimeException("String_Node_Str");
}
 else {
System.out.println("String_Node_Str" + treesRead + "String_Node_Str"+ burnIn+ "String_Node_Str"+ totalTrees+ "String_Node_Str");
}
executor.shutdown();
while (!executor.isTerminated()) {
}
System.out.println("String_Node_Str");
Iterator<Double> iterator=slicesMap.keySet().iterator();
executor=Executors.newFixedThreadPool(NTHREDS);
formatter=new SimpleDateFormat("String_Node_Str",Locale.US);
startTime=timeLine.getStartTime();
endTime=timeLine.getEndTime();
System.out.println("String_Node_Str");
int polygonsStyleId=1;
while (iterator.hasNext()) {
System.out.println("String_Node_Str" + polygonsStyleId + "String_Node_Str");
Double sliceTime=iterator.next();
new Polygons(sliceTime,polygonsStyleId).run();
polygonsStyleId++;
}
switch (analysisType) {
case FIRST_ANALYSIS:
System.out.println("String_Node_Str");
executor.submit(new Branches());
break;
case SECOND_ANALYSIS:
break;
}
executor.shutdown();
while (!executor.isTerminated()) {
}
System.out.println("String_Node_Str");
PrintWriter writer=new PrintWriter(kmlPath);
KMLGenerator kmloutput=new KMLGenerator();
kmloutput.generate(writer,timeLine,layers);
time+=System.currentTimeMillis();
}