Program: 109454
Project: 109454
Buggy source:
@Override public void perform(GraphRewrite event,EvaluationContext context,WindupConfigurationModel config){
  InlineHintService hintService=new InlineHintService(event.getGraphContext());
  ClassificationService classificationService=new ClassificationService(event.getGraphContext());
  ProjectService projectService=new ProjectService(event.getGraphContext());
  final Iterable<InlineHintModel> hints=hintService.findAll();
  final Iterable<ProjectModel> projects=projectService.findAll();
  final Iterable<ClassificationModel> classifications=classificationService.findAll();
  Map<String,CSVWriter> rootProjectWriters=new HashMap<>();
  for (  ProjectModel project : projects) {
    ProjectModel root=project.getRootProjectModel();
    if (!rootProjectWriters.containsKey(root.getName())) {
      try {
        CSVWriter writer=new CSVWriter(new FileWriter(config.getOutputPath().getFilePath() + File.separator + root.getName()+ "String_Node_Str"),';');
        String[] headerLine=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
        writer.writeNext(headerLine);
        rootProjectWriters.put(root.getName(),writer);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  try {
    for (    InlineHintModel hint : hints) {
      final ProjectModel parentRootProjectModel=hint.getFile().getProjectModel().getRootProjectModel();
      String links=buildLinkString(hint.getLinks());
      String ruleId=hint.getRuleID() != null ? hint.getRuleID() : "String_Node_Str";
      String title=hint.getTitle() != null ? hint.getTitle() : "String_Node_Str";
      String description=hint.getDescription() != null ? hint.getDescription() : "String_Node_Str";
      String projectNameString="String_Node_Str";
      String fileName="String_Node_Str";
      String filePath="String_Node_Str";
      if (hint.getFile() != null) {
        if (hint.getFile().getProjectModel() != null) {
          projectNameString=hint.getFile().getProjectModel().getName();
        }
        fileName=hint.getFile().getFileName();
        filePath=hint.getFile().getFilePath();
      }
      String[] strings=new String[]{ruleId,"String_Node_Str",title,description,links,projectNameString,fileName,filePath,String.valueOf(hint.getLineNumber()),String.valueOf(hint.getEffort())};
      rootProjectWriters.get(parentRootProjectModel.getName()).writeNext(strings);
    }
    for (    ClassificationModel classification : classifications) {
      for (      FileModel fileModel : classification.getFileModels()) {
        final ProjectModel parentRootProjectModel=fileModel.getProjectModel().getRootProjectModel();
        String links=buildLinkString(classification.getLinks());
        String ruleId=classification.getRuleID() != null ? classification.getRuleID() : "String_Node_Str";
        String classifText=classification.getClassification() != null ? classification.getClassification() : "String_Node_Str";
        String description=classification.getDescription() != null ? classification.getDescription() : "String_Node_Str";
        String projectNameString="String_Node_Str";
        String fileName="String_Node_Str";
        String filePath="String_Node_Str";
        if (fileModel.getProjectModel() != null) {
          projectNameString=fileModel.getProjectModel().getName();
        }
        fileName=fileModel.getFileName();
        filePath=fileModel.getFilePath();
        String[] strings=new String[]{ruleId,"String_Node_Str",classifText,description,links,projectNameString,fileName,filePath,"String_Node_Str",String.valueOf(classification.getEffort())};
        rootProjectWriters.get(parentRootProjectModel.getName()).writeNext(strings);
      }
    }
  }
  finally {
    for (    CSVWriter csvWriter : rootProjectWriters.values()) {
      try {
        csvWriter.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void perform(GraphRewrite event,EvaluationContext context,WindupConfigurationModel config){
  projectToFile=new HashMap<>();
  InlineHintService hintService=new InlineHintService(event.getGraphContext());
  String outputFolderPath=config.getOutputPath().getFilePath() + File.separator;
  ClassificationService classificationService=new ClassificationService(event.getGraphContext());
  ProjectService projectService=new ProjectService(event.getGraphContext());
  final Iterable<InlineHintModel> hints=hintService.findAll();
  final Iterable<ProjectModel> projects=projectService.findAll();
  final Iterable<ClassificationModel> classifications=classificationService.findAll();
  try {
    for (    InlineHintModel hint : hints) {
      final ProjectModel parentRootProjectModel=hint.getFile().getProjectModel().getRootProjectModel();
      String links=buildLinkString(hint.getLinks());
      String ruleId=hint.getRuleID() != null ? hint.getRuleID() : "String_Node_Str";
      String title=hint.getTitle() != null ? hint.getTitle() : "String_Node_Str";
      String description=hint.getDescription() != null ? hint.getDescription() : "String_Node_Str";
      String projectNameString="String_Node_Str";
      String fileName="String_Node_Str";
      String filePath="String_Node_Str";
      if (hint.getFile() != null) {
        if (hint.getFile().getProjectModel() != null) {
          projectNameString=hint.getFile().getProjectModel().getName();
        }
        fileName=hint.getFile().getFileName();
        filePath=hint.getFile().getFilePath();
      }
      String[] strings=new String[]{ruleId,"String_Node_Str",title,description,links,projectNameString,fileName,filePath,String.valueOf(hint.getLineNumber()),String.valueOf(hint.getEffort())};
      writeCsvRecordForProject(outputFolderPath,parentRootProjectModel,strings);
    }
    for (    ClassificationModel classification : classifications) {
      for (      FileModel fileModel : classification.getFileModels()) {
        final ProjectModel parentRootProjectModel=fileModel.getProjectModel().getRootProjectModel();
        String links=buildLinkString(classification.getLinks());
        String ruleId=classification.getRuleID() != null ? classification.getRuleID() : "String_Node_Str";
        String classifText=classification.getClassification() != null ? classification.getClassification() : "String_Node_Str";
        String description=classification.getDescription() != null ? classification.getDescription() : "String_Node_Str";
        String projectNameString="String_Node_Str";
        String fileName="String_Node_Str";
        String filePath="String_Node_Str";
        if (fileModel.getProjectModel() != null) {
          projectNameString=fileModel.getProjectModel().getName();
        }
        fileName=fileModel.getFileName();
        filePath=fileModel.getFilePath();
        String[] strings=new String[]{ruleId,"String_Node_Str",classifText,description,links,projectNameString,fileName,filePath,"String_Node_Str",String.valueOf(classification.getEffort())};
        writeCsvRecordForProject(outputFolderPath,parentRootProjectModel,strings);
      }
    }
  }
  finally {
    for (    CSVWriter csvWriter : projectToFile.values()) {
      try {
        csvWriter.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
}