Program: 12143
Project: 12143
Buggy source:
/** 
 * This runs a test.  This assume we're already in the child JVM or at least are only ever running one test.
 * @param testRunners All the tests
 * @param testCategories All the test categories
 * @return Whether running the tests was successful or not
 */
private int runTest(TestRunner testRunner){
  Test test=testRunner.getTest();
  TestSettings settings=test.getTestSettings();
  if (!singleTest) {
    out.println("String_Node_Str" + test.getTestName());
    out.flush();
  }
  Table table=new Table();
  for (int k=0; k < 14; k++) {
    Row row=new Row();
switch (k) {
case 0:
      row.add(new Cell(test.getTestName()));
    row.add(new Cell("String_Node_Str"));
  row.add(new Cell("String_Node_Str" + csoarTestFactory.getLabel()));
break;
case 1:
row.add(new Cell("String_Node_Str"));
break;
case 2:
row.add(new Cell("String_Node_Str"));
break;
case 3:
row.add(new Cell("String_Node_Str"));
break;
case 4:
row.add(new Cell("String_Node_Str"));
break;
case 5:
row.add(new Cell("String_Node_Str"));
break;
case 6:
row.add(new Cell("String_Node_Str"));
break;
case 7:
row.add(new Cell("String_Node_Str"));
break;
case 8:
row.add(new Cell("String_Node_Str"));
break;
case 9:
row.add(new Cell("String_Node_Str"));
break;
case 10:
row.add(new Cell("String_Node_Str"));
break;
case 11:
row.add(new Cell("String_Node_Str"));
break;
case 12:
row.add(new Cell("String_Node_Str"));
break;
case 13:
row.add(new Cell("String_Node_Str"));
break;
}
table.addRow(row);
}
int column=2 - 1;
if (settings.isJSoarEnabled()) {
out.println("String_Node_Str");
out.flush();
column=2 - 1;
}
 else if (settings.isCSoarEnabled()) {
out.println("String_Node_Str" + csoarTestFactory.getLabel() + "String_Node_Str");
out.flush();
column=3 - 1;
}
try {
testRunner.runTestsForAverage(settings);
}
 catch (SoarException e) {
out.println("String_Node_Str" + e.getMessage());
return EXIT_FAILURE;
}
table.setOrAddValueAtLocation(new Double(testRunner.getTotalCPUTime()).toString(),2 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getAverageCPUTime()).toString(),3 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMedianCPUTime()).toString(),4 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getTotalKernelTime()).toString(),5 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getAverageKernelTime()).toString(),6 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMedianKernelTime()).toString(),7 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getTotalDecisionCycles()).toString(),8 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getAverageDecisionCycles()).toString(),9 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMedianDecisionCycles()).toString(),10 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getTotalMemoryLoad() / 1000.0 / 1000.0).toString(),11 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getAverageMemoryLoad() / 1000.0 / 1000.0).toString(),12 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMedianMemoryLoad() / 1000.0 / 1000.0).toString(),13 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMemoryLoadDeviation() / 1000.0 / 1000.0).toString(),14 - 1,column);
if (settings.getCSVDirectory().length() != 0) {
String csvDirectoryString=test.getTestSettings().getCSVDirectory();
String testNameWithoutSpaces=test.getTestName().replaceAll("String_Node_Str","String_Node_Str");
String testDirectoryString=csvDirectoryString + "String_Node_Str" + testNameWithoutSpaces;
String categoryDirectoryString=null;
if (settings.isJSoarEnabled()) {
categoryDirectoryString=testDirectoryString + "String_Node_Str";
}
 else {
categoryDirectoryString=testDirectoryString + "String_Node_Str";
if (csoarTestFactory.getLabel().length() != 0) {
categoryDirectoryString+="String_Node_Str";
categoryDirectoryString+=csoarTestFactory.getLabel().replaceAll("String_Node_Str","String_Node_Str");
}
}
String finalPathDirectoryString=categoryDirectoryString;
File finalPathDirectory=new File(finalPathDirectoryString);
if (!finalPathDirectory.exists()) {
finalPathDirectory.mkdirs();
}
String finalTestName=testNameWithoutSpaces;
if (test.getTestSettings().getDecisionCycles().get(0) != 0) {
finalTestName+="String_Node_Str" + test.getTestSettings().getDecisionCycles().get(0);
}
 else {
finalTestName+="String_Node_Str";
}
if (runNumber != -1) {
finalTestName+="String_Node_Str" + runNumber;
}
table.writeToCSV(finalPathDirectoryString + "String_Node_Str" + finalTestName+ "String_Node_Str");
if (outputToSummaryFile) {
table.writeToCSV(settings.getCSVDirectory() + "String_Node_Str" + settings.getSummaryFile(),true);
}
}
out.print("String_Node_Str");
out.flush();
return NON_EXIT;
}

Fixed version (ground truth):
/** 
 * This runs a test.  This assume we're already in the child JVM or at least are only ever running one test.
 * @param testRunners All the tests
 * @param testCategories All the test categories
 * @return Whether running the tests was successful or not
 */
private int runTest(TestRunner testRunner){
  Test test=testRunner.getTest();
  TestSettings settings=test.getTestSettings();
  if (!singleTest) {
    out.println("String_Node_Str" + test.getTestName());
    out.flush();
  }
  Table table=new Table();
  for (int k=0; k < 14; k++) {
    Row row=new Row();
switch (k) {
case 0:
      row.add(new Cell(test.getTestName()));
    row.add(new Cell("String_Node_Str"));
  row.add(new Cell("String_Node_Str" + csoarTestFactory.getLabel()));
break;
case 1:
row.add(new Cell("String_Node_Str"));
break;
case 2:
row.add(new Cell("String_Node_Str"));
break;
case 3:
row.add(new Cell("String_Node_Str"));
break;
case 4:
row.add(new Cell("String_Node_Str"));
break;
case 5:
row.add(new Cell("String_Node_Str"));
break;
case 6:
row.add(new Cell("String_Node_Str"));
break;
case 7:
row.add(new Cell("String_Node_Str"));
break;
case 8:
row.add(new Cell("String_Node_Str"));
break;
case 9:
row.add(new Cell("String_Node_Str"));
break;
case 10:
row.add(new Cell("String_Node_Str"));
break;
case 11:
row.add(new Cell("String_Node_Str"));
break;
case 12:
row.add(new Cell("String_Node_Str"));
break;
case 13:
row.add(new Cell("String_Node_Str"));
break;
}
table.addRow(row);
}
int column=2 - 1;
if (settings.isJSoarEnabled()) {
out.println("String_Node_Str");
out.flush();
column=2 - 1;
}
 else if (settings.isCSoarEnabled()) {
out.println("String_Node_Str" + csoarTestFactory.getLabel() + "String_Node_Str");
out.flush();
column=3 - 1;
}
try {
testRunner.runTestsForAverage(settings);
}
 catch (SoarException e) {
out.println("String_Node_Str" + e.getMessage());
return EXIT_FAILURE;
}
catch (RuntimeException e) {
if (e.getMessage() != null) {
String message=e.getMessage();
if (message.equals("String_Node_Str") && settings.getCSoarVersions().size() > 0) {
message+="String_Node_Str" + settings.getCSoarVersions().get(0);
}
out.println("String_Node_Str" + message);
}
 else {
out.println("String_Node_Str");
}
return EXIT_FAILURE;
}
table.setOrAddValueAtLocation(new Double(testRunner.getTotalCPUTime()).toString(),2 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getAverageCPUTime()).toString(),3 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMedianCPUTime()).toString(),4 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getTotalKernelTime()).toString(),5 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getAverageKernelTime()).toString(),6 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMedianKernelTime()).toString(),7 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getTotalDecisionCycles()).toString(),8 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getAverageDecisionCycles()).toString(),9 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMedianDecisionCycles()).toString(),10 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getTotalMemoryLoad() / 1000.0 / 1000.0).toString(),11 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getAverageMemoryLoad() / 1000.0 / 1000.0).toString(),12 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMedianMemoryLoad() / 1000.0 / 1000.0).toString(),13 - 1,column);
table.setOrAddValueAtLocation(new Double(testRunner.getMemoryLoadDeviation() / 1000.0 / 1000.0).toString(),14 - 1,column);
if (settings.getCSVDirectory().length() != 0) {
String csvDirectoryString=test.getTestSettings().getCSVDirectory();
String testNameWithoutSpaces=test.getTestName().replaceAll("String_Node_Str","String_Node_Str");
String testDirectoryString=csvDirectoryString + "String_Node_Str" + testNameWithoutSpaces;
String categoryDirectoryString=null;
if (settings.isJSoarEnabled()) {
categoryDirectoryString=testDirectoryString + "String_Node_Str";
}
 else {
categoryDirectoryString=testDirectoryString + "String_Node_Str";
if (csoarTestFactory.getLabel().length() != 0) {
categoryDirectoryString+="String_Node_Str";
categoryDirectoryString+=csoarTestFactory.getLabel().replaceAll("String_Node_Str","String_Node_Str");
}
}
String finalPathDirectoryString=categoryDirectoryString;
File finalPathDirectory=new File(finalPathDirectoryString);
if (!finalPathDirectory.exists()) {
finalPathDirectory.mkdirs();
}
String finalTestName=testNameWithoutSpaces;
if (test.getTestSettings().getDecisionCycles().get(0) != 0) {
finalTestName+="String_Node_Str" + test.getTestSettings().getDecisionCycles().get(0);
}
 else {
finalTestName+="String_Node_Str";
}
if (runNumber != -1) {
finalTestName+="String_Node_Str" + runNumber;
}
table.writeToCSV(finalPathDirectoryString + "String_Node_Str" + finalTestName+ "String_Node_Str");
if (outputToSummaryFile) {
table.writeToCSV(settings.getCSVDirectory() + "String_Node_Str" + settings.getSummaryFile(),true);
}
}
out.print("String_Node_Str");
out.flush();
return NON_EXIT;
}