Program: 62366
Project: 62366
Buggy source:
/** 
 * Actually load and link a plugin in Alien 4 Cloud.
 * @param plugin The plugin the load and link.
 * @param pluginPath The path to the directory that contains the un-zipped plugin.
 * @param pluginUiPath The path in which the ui files are located.
 * @throws IOException In case there is an IO issue with the file.
 * @throws ClassNotFoundException If we cannot load the class
 */
private void loadPlugin(Plugin plugin,Path pluginPath,Path pluginUiPath) throws IOException, ClassNotFoundException {
  final List<URL> classPathUrls=Lists.newArrayList();
  pluginPath=pluginPath.toRealPath();
  classPathUrls.add(pluginPath.toUri().toURL());
  Path libPath=pluginPath.resolve(LIB_DIRECTORY);
  if (Files.exists(libPath)) {
    Files.walkFileTree(libPath,new SimpleFileVisitor<Path>(){
      @Override public FileVisitResult visitFile(      Path file,      BasicFileAttributes attrs) throws IOException {
        file.endsWith("String_Node_Str");
        classPathUrls.add(file.toUri().toURL());
        return FileVisitResult.CONTINUE;
      }
    }
);
  }
  ClassLoader pluginClassLoader=new PluginClassloader(classPathUrls.toArray(new URL[classPathUrls.size()]),Thread.currentThread().getContextClassLoader());
  AnnotationConfigApplicationContext pluginContext=new AnnotationConfigApplicationContext();
  pluginContext.setParent(alienContext);
  pluginContext.setClassLoader(pluginClassLoader);
  registerDependencies(plugin,pluginContext);
  if (plugin.getDescriptor().getConfigurationClass() != null) {
    pluginContext.register(pluginClassLoader.loadClass(plugin.getDescriptor().getConfigurationClass()));
  }
  ManagedPlugin managedPlugin=new ManagedPlugin(pluginContext,plugin,pluginPath,pluginUiPath);
  pluginContext.getBeanFactory().registerSingleton("String_Node_Str",managedPlugin);
  pluginContext.refresh();
  Map<String,PluginComponentDescriptor> componentDescriptors=getPluginComponentDescriptorAsMap(plugin);
  expose(managedPlugin,componentDescriptors);
  link(plugin,managedPlugin,componentDescriptors);
  pluginContexts.put(plugin.getId(),managedPlugin);
}

Fixed version (ground truth):
/** 
 * Actually load and link a plugin in Alien 4 Cloud.
 * @param plugin       The plugin the load and link.
 * @param pluginPath   The path to the directory that contains the un-zipped plugin.
 * @param pluginUiPath The path in which the ui files are located.
 * @throws IOException            In case there is an IO issue with the file.
 * @throws ClassNotFoundException If we cannot load the class
 */
private void loadPlugin(Plugin plugin,Path pluginPath,Path pluginUiPath) throws IOException, ClassNotFoundException {
  final List<URL> classPathUrls=Lists.newArrayList();
  pluginPath=pluginPath.toRealPath();
  classPathUrls.add(pluginPath.toUri().toURL());
  Path libPath=pluginPath.resolve(LIB_DIRECTORY);
  if (Files.exists(libPath)) {
    Files.walkFileTree(libPath,new SimpleFileVisitor<Path>(){
      @Override public FileVisitResult visitFile(      Path file,      BasicFileAttributes attrs) throws IOException {
        file.endsWith("String_Node_Str");
        classPathUrls.add(file.toUri().toURL());
        return FileVisitResult.CONTINUE;
      }
    }
);
  }
  ClassLoader pluginClassLoader=new PluginClassloader(classPathUrls.toArray(new URL[classPathUrls.size()]),Thread.currentThread().getContextClassLoader());
  AnnotationConfigApplicationContext pluginContext=new AnnotationConfigApplicationContext();
  pluginContext.setParent(alienContext);
  pluginContext.setClassLoader(pluginClassLoader);
  registerDependencies(plugin,pluginContext);
  if (plugin.getDescriptor().getConfigurationClass() != null) {
    pluginContext.register(pluginClassLoader.loadClass(plugin.getDescriptor().getConfigurationClass()));
  }
  ManagedPlugin managedPlugin=new ManagedPlugin(pluginContext,plugin,pluginPath,pluginUiPath);
  pluginContext.getBeanFactory().registerSingleton("String_Node_Str",managedPlugin);
  pluginContext.refresh();
  Map<String,PluginComponentDescriptor> componentDescriptors=getPluginComponentDescriptorAsMap(plugin);
  expose(managedPlugin,componentDescriptors);
  link(plugin,managedPlugin,componentDescriptors);
  pluginContexts.put(plugin.getId(),managedPlugin);
}