Program: 109428
Project: 109428
Buggy source:
public void perform(final GraphRewrite event,EvaluationContext context){
  ExecutionStatistics.get().begin("String_Node_Str");
  try {
    WindupJavaConfigurationService windupJavaConfigurationService=new WindupJavaConfigurationService(event.getGraphContext());
    WindupJavaConfigurationModel javaConfiguration=WindupJavaConfigurationService.getJavaConfigurationModel(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<>(event.getGraphContext(),JarArchiveModel.class);
    Iterable<JarArchiveModel> libraries=libraryService.findAll();
    Set<String> libraryPaths=new HashSet<>();
    WindupConfigurationModel configurationModel=WindupConfigurationService.getConfigurationModel(event.getGraphContext());
    for (    TechnologyReferenceModel target : configurationModel.getTargetTechnologies()) {
      TechnologyMetadata technologyMetadata=technologyMetadataProvider.getMetadata(event.getGraphContext(),new TechnologyReference(target));
      if (technologyMetadata != null && technologyMetadata instanceof JavaTechnologyMetadata) {
        JavaTechnologyMetadata javaMetadata=(JavaTechnologyMetadata)technologyMetadata;
        for (        Path additionalClasspath : javaMetadata.getAdditionalClasspaths())         libraryPaths.add(additionalClasspath.toString());
      }
    }
    for (    FileModel additionalClasspath : javaConfiguration.getAdditionalClasspaths()) {
      libraryPaths.add(additionalClasspath.getFilePath());
    }
    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.setContext(event.getGraphContext());
      final BlockingQueue<Pair<Path,List<ClassReference>>> processedPaths=new ArrayBlockingQueue<>(ANALYSIS_QUEUE_SIZE);
      final Set<Path> failedPaths=Sets.getConcurrentSet();
      BatchASTListener listener=new BatchASTListener(){
        @Override public void processed(        Path filePath,        List<ClassReference> references){
          try {
            processedPaths.put(new ImmutablePair<>(filePath,filterClassReferences(references)));
          }
 catch (          InterruptedException e) {
            throw new WindupException(e.getMessage(),e);
          }
        }
        @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);
      ProgressEstimate estimate=new ProgressEstimate(filesToProcess.size());
      while (!future.isDone() || !processedPaths.isEmpty()) {
        if (processedPaths.size() > (ANALYSIS_QUEUE_SIZE / 2))         LOG.info("String_Node_Str" + processedPaths.size() + "String_Node_Str"+ ANALYSIS_QUEUE_SIZE);
        Pair<Path,List<ClassReference>> pair=processedPaths.poll(250,TimeUnit.MILLISECONDS);
        if (pair == null)         continue;
        processReferences(event.getGraphContext(),pair.getKey(),pair.getValue());
        estimate.addWork(1);
        printProgressEstimate(event,estimate);
        if (estimate.getWorked() % 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(context,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,filterClassReferences(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(context,sourceFileModel,JavaSourceFileModel.UNPARSEABLE_JAVA_CLASSIFICATION,JavaSourceFileModel.UNPARSEABLE_JAVA_DESCRIPTION);
          }
          estimate.addWork(1);
          printProgressEstimate(event,estimate);
        }
      }
      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(context,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.setContext(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());
    final WindupJavaConfigurationModel javaConfiguration=WindupJavaConfigurationService.getJavaConfigurationModel(event.getGraphContext());
    final boolean classNotFoundAnalysisEnabled=javaConfiguration.isClassNotFoundAnalysisEnabled();
    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<>(event.getGraphContext(),JarArchiveModel.class);
    Iterable<JarArchiveModel> libraries=libraryService.findAll();
    Set<String> libraryPaths=new HashSet<>();
    WindupConfigurationModel configurationModel=WindupConfigurationService.getConfigurationModel(event.getGraphContext());
    for (    TechnologyReferenceModel target : configurationModel.getTargetTechnologies()) {
      TechnologyMetadata technologyMetadata=technologyMetadataProvider.getMetadata(event.getGraphContext(),new TechnologyReference(target));
      if (technologyMetadata != null && technologyMetadata instanceof JavaTechnologyMetadata) {
        JavaTechnologyMetadata javaMetadata=(JavaTechnologyMetadata)technologyMetadata;
        for (        Path additionalClasspath : javaMetadata.getAdditionalClasspaths())         libraryPaths.add(additionalClasspath.toString());
      }
    }
    for (    FileModel additionalClasspath : javaConfiguration.getAdditionalClasspaths()) {
      libraryPaths.add(additionalClasspath.getFilePath());
    }
    for (    JarArchiveModel library : libraries) {
      libraryPaths.add(library.getFilePath());
    }
    ExecutionStatistics.get().begin("String_Node_Str");
    try {
      WindupWildcardImportResolver.setContext(event.getGraphContext());
      final BlockingQueue<Pair<Path,List<ClassReference>>> processedPaths=new ArrayBlockingQueue<>(ANALYSIS_QUEUE_SIZE);
      final Set<Path> failedPaths=Sets.getConcurrentSet();
      BatchASTListener listener=new BatchASTListener(){
        @Override public void processed(        Path filePath,        List<ClassReference> references){
          try {
            processedPaths.put(new ImmutablePair<>(filePath,filterClassReferences(references,classNotFoundAnalysisEnabled)));
          }
 catch (          InterruptedException e) {
            throw new WindupException(e.getMessage(),e);
          }
        }
        @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);
      ProgressEstimate estimate=new ProgressEstimate(filesToProcess.size());
      while (!future.isDone() || !processedPaths.isEmpty()) {
        if (processedPaths.size() > (ANALYSIS_QUEUE_SIZE / 2))         LOG.info("String_Node_Str" + processedPaths.size() + "String_Node_Str"+ ANALYSIS_QUEUE_SIZE);
        Pair<Path,List<ClassReference>> pair=processedPaths.poll(250,TimeUnit.MILLISECONDS);
        if (pair == null)         continue;
        processReferences(event.getGraphContext(),pair.getKey(),pair.getValue());
        estimate.addWork(1);
        printProgressEstimate(event,estimate);
        if (estimate.getWorked() % 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(context,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,filterClassReferences(references,classNotFoundAnalysisEnabled));
            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(context,sourceFileModel,JavaSourceFileModel.UNPARSEABLE_JAVA_CLASSIFICATION,JavaSourceFileModel.UNPARSEABLE_JAVA_DESCRIPTION);
          }
          estimate.addWork(1);
          printProgressEstimate(event,estimate);
        }
      }
      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(context,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.setContext(null);
    }
  }
  finally {
    ExecutionStatistics.get().end("String_Node_Str");
  }
}