Program: 95375
Project: 95375
Buggy source:
/** 
 * @param projectList The list of projects to export
 * @param exportDirName The export directory of the projects
 * @param exportSession The session to be used for Persistence (JPA / EclipseLink)
 * @param monitor The progress monitor
 * @param writeToSystemTempDir Indicates whether the projects have to be written to the system temp directory
 * @param listOfProjectFiles The written project files are added to this list, if the temp dir was used and the list   is not null.
 * @param console The console to use to display progress and  error messages.
 */
public static void exportProjectList(List<IProjectPO> projectList,String exportDirName,EntityManager exportSession,IProgressMonitor monitor,boolean writeToSystemTempDir,List<File> listOfProjectFiles,IProgressConsole console) throws JBException, InterruptedException {
  SubMonitor subMonitor=SubMonitor.convert(monitor,Messages.ExportAllBPExporting,JsonStorage.getWorkToSave(projectList));
  for (  IProjectPO proj : projectList) {
    if (subMonitor.isCanceled()) {
      throw new InterruptedException();
    }
    IProjectPO projectToExport=ProjectPM.loadProjectByIdAndPreLoad(proj.getId(),exportSession);
    String projectFileName=projectToExport.getDisplayName() + JUB;
    final String exportFileName;
    if (writeToSystemTempDir) {
      exportFileName=projectFileName;
    }
 else {
      if (projectToExport.equals(GeneralStorage.getInstance().getProject())) {
        projectToExport=GeneralStorage.getInstance().getProject();
      }
      exportFileName=exportDirName + projectFileName;
    }
    if (subMonitor.isCanceled()) {
      throw new InterruptedException();
    }
    console.writeStatus(new Status(IStatus.INFO,Activator.PLUGIN_ID,NLS.bind(Messages.ExportAllBPInfoStartingExportProject,projectFileName)));
    try {
      if (subMonitor.isCanceled()) {
        throw new InterruptedException();
      }
      JsonStorage.save(projectToExport,exportFileName,true,subMonitor.newChild(1),console);
      if (subMonitor.isCanceled()) {
        throw new InterruptedException();
      }
      console.writeStatus(new Status(IStatus.INFO,Activator.PLUGIN_ID,NLS.bind(Messages.ExportAllBPInfoFinishedExportProject,projectFileName)));
    }
 catch (    final PMSaveException e) {
      LOG.error(Messages.CouldNotExportProject,e);
      console.writeStatus(new Status(IStatus.INFO,Activator.PLUGIN_ID,NLS.bind(Messages.ExportAllBPErrorExportFailedProject,new Object[]{projectFileName,e.getMessage()})));
    }
    exportSession.detach(projectToExport);
  }
}

Fixed version (ground truth):
/** 
 * @param projectList The list of projects to export
 * @param exportDirName The export directory of the projects
 * @param exportSession The session to be used for Persistence (JPA / EclipseLink)
 * @param monitor The progress monitor
 * @param writeToSystemTempDir Indicates whether the projects have to be written to the system temp directory
 * @param listOfProjectFiles The written project files are added to this list, if the temp dir was used and the list   is not null.
 * @param console The console to use to display progress and  error messages.
 */
public static void exportProjectList(List<IProjectPO> projectList,String exportDirName,EntityManager exportSession,IProgressMonitor monitor,boolean writeToSystemTempDir,List<File> listOfProjectFiles,IProgressConsole console) throws JBException, InterruptedException {
  SubMonitor subMonitor=SubMonitor.convert(monitor,Messages.ExportAllBPExporting,JsonStorage.getWorkToSave(projectList));
  for (  IProjectPO proj : projectList) {
    if (subMonitor.isCanceled()) {
      throw new InterruptedException();
    }
    IProjectPO projectToExport=ProjectPM.loadProjectByIdAndPreLoad(proj.getId(),exportSession);
    String projectFileName=projectToExport.getDisplayName() + JUB;
    final String exportFileName;
    if (writeToSystemTempDir) {
      exportFileName=projectFileName;
    }
 else {
      if (projectToExport.equals(GeneralStorage.getInstance().getProject())) {
        projectToExport=GeneralStorage.getInstance().getProject();
      }
      exportFileName=exportDirName + projectFileName;
    }
    if (subMonitor.isCanceled()) {
      throw new InterruptedException();
    }
    console.writeStatus(new Status(IStatus.INFO,Activator.PLUGIN_ID,NLS.bind(Messages.ExportAllBPInfoStartingExportProject,projectFileName)));
    try {
      if (subMonitor.isCanceled()) {
        throw new InterruptedException();
      }
      JsonStorage.save(projectToExport,exportFileName,true,subMonitor.newChild(1),console);
      if (subMonitor.isCanceled()) {
        throw new InterruptedException();
      }
      console.writeStatus(new Status(IStatus.INFO,Activator.PLUGIN_ID,NLS.bind(Messages.ExportAllBPInfoFinishedExportProject,projectFileName)));
    }
 catch (    final PMSaveException e) {
      LOG.error(Messages.CouldNotExportProject,e);
      console.writeStatus(new Status(IStatus.INFO,Activator.PLUGIN_ID,NLS.bind(Messages.ExportAllBPErrorExportFailedProject,new Object[]{projectFileName,e.getMessage()})));
    }
    exportSession.detach(projectToExport);
    exportSession.clear();
  }
}