Program: 109488
Project: 109488
Buggy source:
public void perform(final GraphRewrite event,EvaluationContext context){
  ExecutionStatistics.get().begin("String_Node_Str");
  try {
    WindupJavaConfigurationService windupJavaConfigurationService=new WindupJavaConfigurationService(event.getGraphContext());
    GraphService<JavaSourceFileModel> service=new GraphService<>(event.getGraphContext(),JavaSourceFileModel.class);
    Iterable<JavaSourceFileModel> allJavaSourceModels=service.findAll();
    final Set<Path> allSourceFiles=new TreeSet<>();
    Set<String> sourcePaths=new HashSet<>();
    for (    JavaSourceFileModel javaFile : allJavaSourceModels) {
      FileModel rootSourceFolder=javaFile.getRootSourceFolder();
      if (rootSourceFolder != null) {
        sourcePaths.add(rootSourceFolder.getFilePath());
      }
      if (windupJavaConfigurationService.shouldScanPackage(javaFile.getPackageName())) {
        Path path=Paths.get(javaFile.getFilePath());
        allSourceFiles.add(path);
        sourcePathToFileModel.put(path,javaFile);
      }
    }
    GraphService<JarArchiveModel> libraryService=new GraphService<JarArchiveModel>(event.getGraphContext(),JarArchiveModel.class);
    Iterable<JarArchiveModel> libraries=libraryService.findAll();
    Set<String> libraryPaths=new HashSet<>();
    for (    JarArchiveModel library : libraries) {
      if (library.getUnzippedDirectory() != null) {
        libraryPaths.add(library.getUnzippedDirectory().getFilePath());
      }
 else {
        libraryPaths.add(library.getFilePath());
      }
    }
    ExecutionStatistics.get().begin("String_Node_Str");
    try {
      WindupWildcardImportResolver.setGraphContext(event.getGraphContext());
      final int totalToProcess=allSourceFiles.size();
      final AtomicInteger numberProcessed=new AtomicInteger(0);
      final BlockingQueue<Pair<Path,List<ClassReference>>> processedPaths=new ArrayBlockingQueue<>(1000);
      final Set<Path> failedPaths=Sets.getConcurrentSet();
      BatchASTListener listener=new BatchASTListener(){
        @Override public void processed(        Path filePath,        List<ClassReference> references){
          try {
            processedPaths.put(new ImmutablePair<Path,List<ClassReference>>(filePath,references));
          }
 catch (          InterruptedException e) {
            throw new WindupException(e.getMessage(),e);
          }
          numberProcessed.incrementAndGet();
        }
        @Override public void failed(        Path filePath,        Throwable cause){
          LOG.log(Level.WARNING,"String_Node_Str" + filePath + "String_Node_Str"+ cause.getMessage(),cause);
          failedPaths.add(filePath);
        }
      }
;
      Set<Path> filesToProcess=new TreeSet<>(allSourceFiles);
      BatchASTFuture future=BatchASTProcessor.analyze(listener,importResolver,libraryPaths,sourcePaths,filesToProcess);
      while (!future.isDone() || !processedPaths.isEmpty()) {
        Pair<Path,List<ClassReference>> pair=processedPaths.poll(1000,TimeUnit.SECONDS);
        processReferences(event.getGraphContext(),pair.getKey(),pair.getValue());
        if (numberProcessed.get() % LOG_INTERVAL == 0) {
          LOG.info("String_Node_Str" + numberProcessed.get() + "String_Node_Str"+ totalToProcess);
        }
        if (numberProcessed.get() % COMMIT_INTERVAL == 0) {
          event.getGraphContext().getGraph().getBaseGraph().commit();
        }
        filesToProcess.remove(pair.getKey());
      }
      for (      Path path : failedPaths) {
        ClassificationService classificationService=new ClassificationService(event.getGraphContext());
        JavaSourceFileModel sourceFileModel=getJavaSourceFileModel(event.getGraphContext(),path);
        classificationService.attachClassification(sourceFileModel,JavaSourceFileModel.UNPARSEABLE_JAVA_CLASSIFICATION,JavaSourceFileModel.UNPARSEABLE_JAVA_DESCRIPTION);
      }
      if (!filesToProcess.isEmpty()) {
        for (        Path unprocessed : new ArrayList<>(filesToProcess)) {
          try {
            List<ClassReference> references=ASTProcessor.analyze(importResolver,libraryPaths,sourcePaths,unprocessed);
            processReferences(event.getGraphContext(),unprocessed,references);
            filesToProcess.remove(unprocessed);
          }
 catch (          Exception e) {
            LOG.log(Level.WARNING,"String_Node_Str" + unprocessed + "String_Node_Str"+ e.getMessage(),e);
            ClassificationService classificationService=new ClassificationService(event.getGraphContext());
            JavaSourceFileModel sourceFileModel=getJavaSourceFileModel(event.getGraphContext(),unprocessed);
            classificationService.attachClassification(sourceFileModel,JavaSourceFileModel.UNPARSEABLE_JAVA_CLASSIFICATION,JavaSourceFileModel.UNPARSEABLE_JAVA_DESCRIPTION);
          }
        }
      }
      if (!filesToProcess.isEmpty()) {
        ClassificationService classificationService=new ClassificationService(event.getGraphContext());
        StringBuilder message=new StringBuilder();
        message.append("String_Node_Str" + filesToProcess.size() + "String_Node_Str");
        for (        Path unprocessed : filesToProcess) {
          JavaSourceFileModel sourceFileModel=getJavaSourceFileModel(event.getGraphContext(),unprocessed);
          message.append("String_Node_Str" + unprocessed + "String_Node_Str");
          classificationService.attachClassification(sourceFileModel,JavaSourceFileModel.UNPARSEABLE_JAVA_CLASSIFICATION,JavaSourceFileModel.UNPARSEABLE_JAVA_DESCRIPTION);
        }
        LOG.warning(message.toString());
      }
      ExecutionStatistics.get().end("String_Node_Str");
    }
 catch (    Exception e) {
      LOG.log(Level.SEVERE,"String_Node_Str" + e.getMessage(),e);
    }
 finally {
      WindupWildcardImportResolver.setGraphContext(null);
    }
  }
  finally {
    ExecutionStatistics.get().end("String_Node_Str");
  }
}

Fixed version (ground truth):
public void perform(final GraphRewrite event,EvaluationContext context){
  ExecutionStatistics.get().begin("String_Node_Str");
  try {
    WindupJavaConfigurationService windupJavaConfigurationService=new WindupJavaConfigurationService(event.getGraphContext());
    GraphService<JavaSourceFileModel> service=new GraphService<>(event.getGraphContext(),JavaSourceFileModel.class);
    Iterable<JavaSourceFileModel> allJavaSourceModels=service.findAll();
    final Set<Path> allSourceFiles=new TreeSet<>();
    Set<String> sourcePaths=new HashSet<>();
    for (    JavaSourceFileModel javaFile : allJavaSourceModels) {
      FileModel rootSourceFolder=javaFile.getRootSourceFolder();
      if (rootSourceFolder != null) {
        sourcePaths.add(rootSourceFolder.getFilePath());
      }
      if (windupJavaConfigurationService.shouldScanPackage(javaFile.getPackageName())) {
        Path path=Paths.get(javaFile.getFilePath());
        allSourceFiles.add(path);
        sourcePathToFileModel.put(path,javaFile);
      }
    }
    GraphService<JarArchiveModel> libraryService=new GraphService<JarArchiveModel>(event.getGraphContext(),JarArchiveModel.class);
    Iterable<JarArchiveModel> libraries=libraryService.findAll();
    Set<String> libraryPaths=new HashSet<>();
    for (    JarArchiveModel library : libraries) {
      if (library.getUnzippedDirectory() != null) {
        libraryPaths.add(library.getUnzippedDirectory().getFilePath());
      }
 else {
        libraryPaths.add(library.getFilePath());
      }
    }
    ExecutionStatistics.get().begin("String_Node_Str");
    try {
      WindupWildcardImportResolver.setGraphContext(event.getGraphContext());
      final int totalToProcess=allSourceFiles.size();
      final AtomicInteger numberProcessed=new AtomicInteger(0);
      final BlockingQueue<Pair<Path,List<ClassReference>>> processedPaths=new ArrayBlockingQueue<>(1000);
      final Set<Path> failedPaths=Sets.getConcurrentSet();
      BatchASTListener listener=new BatchASTListener(){
        @Override public void processed(        Path filePath,        List<ClassReference> references){
          try {
            processedPaths.put(new ImmutablePair<Path,List<ClassReference>>(filePath,references));
          }
 catch (          InterruptedException e) {
            throw new WindupException(e.getMessage(),e);
          }
          numberProcessed.incrementAndGet();
        }
        @Override public void failed(        Path filePath,        Throwable cause){
          LOG.log(Level.WARNING,"String_Node_Str" + filePath + "String_Node_Str"+ cause.getMessage(),cause);
          failedPaths.add(filePath);
        }
      }
;
      Set<Path> filesToProcess=new TreeSet<>(allSourceFiles);
      BatchASTFuture future=BatchASTProcessor.analyze(listener,importResolver,libraryPaths,sourcePaths,filesToProcess);
      while (!future.isDone() || !processedPaths.isEmpty()) {
        Pair<Path,List<ClassReference>> pair=processedPaths.poll(250,TimeUnit.MILLISECONDS);
        processReferences(event.getGraphContext(),pair.getKey(),pair.getValue());
        if (numberProcessed.get() % LOG_INTERVAL == 0) {
          LOG.info("String_Node_Str" + numberProcessed.get() + "String_Node_Str"+ totalToProcess);
        }
        if (numberProcessed.get() % COMMIT_INTERVAL == 0) {
          event.getGraphContext().getGraph().getBaseGraph().commit();
        }
        filesToProcess.remove(pair.getKey());
      }
      for (      Path path : failedPaths) {
        ClassificationService classificationService=new ClassificationService(event.getGraphContext());
        JavaSourceFileModel sourceFileModel=getJavaSourceFileModel(event.getGraphContext(),path);
        classificationService.attachClassification(sourceFileModel,JavaSourceFileModel.UNPARSEABLE_JAVA_CLASSIFICATION,JavaSourceFileModel.UNPARSEABLE_JAVA_DESCRIPTION);
      }
      if (!filesToProcess.isEmpty()) {
        for (        Path unprocessed : new ArrayList<>(filesToProcess)) {
          try {
            List<ClassReference> references=ASTProcessor.analyze(importResolver,libraryPaths,sourcePaths,unprocessed);
            processReferences(event.getGraphContext(),unprocessed,references);
            filesToProcess.remove(unprocessed);
          }
 catch (          Exception e) {
            LOG.log(Level.WARNING,"String_Node_Str" + unprocessed + "String_Node_Str"+ e.getMessage(),e);
            ClassificationService classificationService=new ClassificationService(event.getGraphContext());
            JavaSourceFileModel sourceFileModel=getJavaSourceFileModel(event.getGraphContext(),unprocessed);
            classificationService.attachClassification(sourceFileModel,JavaSourceFileModel.UNPARSEABLE_JAVA_CLASSIFICATION,JavaSourceFileModel.UNPARSEABLE_JAVA_DESCRIPTION);
          }
        }
      }
      if (!filesToProcess.isEmpty()) {
        ClassificationService classificationService=new ClassificationService(event.getGraphContext());
        StringBuilder message=new StringBuilder();
        message.append("String_Node_Str" + filesToProcess.size() + "String_Node_Str");
        for (        Path unprocessed : filesToProcess) {
          JavaSourceFileModel sourceFileModel=getJavaSourceFileModel(event.getGraphContext(),unprocessed);
          message.append("String_Node_Str" + unprocessed + "String_Node_Str");
          classificationService.attachClassification(sourceFileModel,JavaSourceFileModel.UNPARSEABLE_JAVA_CLASSIFICATION,JavaSourceFileModel.UNPARSEABLE_JAVA_DESCRIPTION);
        }
        LOG.warning(message.toString());
      }
      ExecutionStatistics.get().end("String_Node_Str");
    }
 catch (    Exception e) {
      LOG.log(Level.SEVERE,"String_Node_Str" + e.getMessage(),e);
    }
 finally {
      WindupWildcardImportResolver.setGraphContext(null);
    }
  }
  finally {
    ExecutionStatistics.get().end("String_Node_Str");
  }
}