Program: 28714
Project: 28714
Buggy source:
/** 
 * Populates the ApplicationServiceLocator with services using the current appClassLoader.  Services must be described in files named META-INF/hk2-locator/application.    {@link PopulationPostProcessor} may be definedin the META-INF/services standard way
 * @throws IOException On failure to read the service files
 */
private void populateApplicationServiceLocator() throws IOException {
  ServiceLoader<PopulatorPostProcessor> postProcessors=ServiceLoader.load(PopulatorPostProcessor.class,appClassLoader);
  LinkedList<PopulatorPostProcessor> allProcessors=new LinkedList<PopulatorPostProcessor>();
  for (  PopulatorPostProcessor postProcessor : postProcessors) {
    allProcessors.add(postProcessor);
  }
  allProcessors.addLast(new ApplicationClassLoadingPostProcessor(appClassLoader));
  HK2Populator.populate(appServiceLocator,new ApplicationDescriptorFileFinder(appClassLoader,APPLICATION_LOADER_FILES),allProcessors);
  HashSet<ClassLoader> treatedLoaders=new HashSet<ClassLoader>();
  treatedLoaders.add(appClassLoader);
  for (  ModuleInfo module : modules) {
    ClassLoader moduleClassLoader=module.getModuleClassLoader();
    if ((moduleClassLoader == null) || treatedLoaders.contains(moduleClassLoader)) {
      continue;
    }
    treatedLoaders.add(moduleClassLoader);
    allProcessors.removeLast();
    allProcessors.addLast(new ApplicationClassLoadingPostProcessor(moduleClassLoader));
    HK2Populator.populate(appServiceLocator,new ApplicationDescriptorFileFinder(moduleClassLoader,WEB_LOADER_FILES),allProcessors);
  }
}

Fixed version (ground truth):
/** 
 * Populates the ApplicationServiceLocator with services using the current appClassLoader.  Services must be described in files named META-INF/hk2-locator/application.    {@link PopulationPostProcessor} may be definedin the META-INF/services standard way
 * @throws IOException On failure to read the service files
 */
private void populateApplicationServiceLocator() throws IOException {
  createServiceLocator();
  ServiceLoader<PopulatorPostProcessor> postProcessors=ServiceLoader.load(PopulatorPostProcessor.class,appClassLoader);
  LinkedList<PopulatorPostProcessor> allProcessors=new LinkedList<PopulatorPostProcessor>();
  for (  PopulatorPostProcessor postProcessor : postProcessors) {
    allProcessors.add(postProcessor);
  }
  allProcessors.addLast(new ApplicationClassLoadingPostProcessor(appClassLoader));
  HK2Populator.populate(appServiceLocator,new ApplicationDescriptorFileFinder(appClassLoader,APPLICATION_LOADER_FILES),allProcessors);
  HashSet<ClassLoader> treatedLoaders=new HashSet<ClassLoader>();
  treatedLoaders.add(appClassLoader);
  for (  ModuleInfo module : modules) {
    ClassLoader moduleClassLoader=module.getModuleClassLoader();
    if ((moduleClassLoader == null) || treatedLoaders.contains(moduleClassLoader)) {
      continue;
    }
    treatedLoaders.add(moduleClassLoader);
    allProcessors.removeLast();
    allProcessors.addLast(new ApplicationClassLoadingPostProcessor(moduleClassLoader));
    HK2Populator.populate(appServiceLocator,new ApplicationDescriptorFileFinder(moduleClassLoader,WEB_LOADER_FILES),allProcessors);
  }
}