Program: 19539
Project: 19539
Buggy source:
@Override public void execute() throws MojoExecutionException, MojoFailureException {
  ClassLoader contextCL=Thread.currentThread().getContextClassLoader();
  Faces faces=null;
  ExecutorService executorService=null;
  Collection<VFSRoot> webResources=null;
  Collection<VFSRoot> cpResources=null;
  try {
    URL[] projectCP=getProjectClassPath();
    ClassLoader projectCL=createProjectClassLoader(projectCP);
    Thread.currentThread().setContextClassLoader(projectCL);
    webResources=getWebrootVfs();
    cpResources=getClasspathVfs(projectCP);
    Collection<VirtualFile> resourceRoots=ResourceUtil.getResourceRoots(cpResources,webResources);
    scanStaticResources(resourceRoots);
    StaticResourceHandler staticResourceHandler=new StaticResourceHandler(resourceRoots);
    ResourceFactory resourceFactory=new ResourceFactoryImpl(staticResourceHandler);
    scanDynamicResources(cpResources,resourceFactory);
    File resourceOutputDir=new File(outputDir);
    if (!resourceOutputDir.exists()) {
      resourceOutputDir=new File(project.getBuild().getDirectory(),outputDir);
    }
    File resourceMappingDir=new File(project.getBuild().getOutputDirectory());
    ResourceHandler resourceHandler=new DynamicResourceHandler(staticResourceHandler,resourceFactory);
    faces=new FacesImpl(null,new FileNameMapperImpl(fileNameMappings),resourceHandler);
    faces.start();
    ResourceWriterImpl resourceWriter=new ResourceWriterImpl(resourceOutputDir,resourceMappingDir,resourceProcessors);
    ResourceTaskFactoryImpl taskFactory=new ResourceTaskFactoryImpl(faces);
    taskFactory.setResourceWriter(resourceWriter);
    executorService=createExecutorService();
    CompletionService<Object> completionService=new CountingExecutorCompletionService<Object>(executorService);
    taskFactory.setCompletionService(completionService);
    taskFactory.setSkins(skins);
    taskFactory.setLog(getLog());
    taskFactory.setFilter(createResourcesFilter());
    taskFactory.submit(foundResources);
    Future<Object> future=null;
    while (true) {
      future=completionService.take();
      if (future != null) {
        try {
          future.get();
        }
 catch (        ExecutionException e) {
          e.getCause().printStackTrace();
        }
      }
 else {
        break;
      }
    }
    resourceWriter.writeProcessedResourceMappings();
  }
 catch (  Exception e) {
    throw new MojoExecutionException(e.getMessage(),e);
  }
 finally {
    if (cpResources != null) {
      for (      VFSRoot vfsRoot : cpResources) {
        try {
          vfsRoot.close();
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
    }
    if (webResources != null) {
      for (      VFSRoot vfsRoot : webResources) {
        try {
          vfsRoot.close();
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
    }
    if (executorService != null) {
      executorService.shutdown();
    }
    if (faces != null) {
      faces.stop();
    }
    Thread.currentThread().setContextClassLoader(contextCL);
  }
}

Fixed version (ground truth):
@Override public void execute() throws MojoExecutionException, MojoFailureException {
  ClassLoader contextCL=Thread.currentThread().getContextClassLoader();
  Faces faces=null;
  ExecutorService executorService=null;
  Collection<VFSRoot> webResources=null;
  Collection<VFSRoot> cpResources=null;
  try {
    URL[] projectCP=getProjectClassPath();
    ClassLoader projectCL=createProjectClassLoader(projectCP);
    Thread.currentThread().setContextClassLoader(projectCL);
    webResources=getWebrootVfs();
    cpResources=getClasspathVfs(projectCP);
    Collection<VirtualFile> resourceRoots=ResourceUtil.getResourceRoots(cpResources,webResources);
    scanStaticResources(resourceRoots);
    StaticResourceHandler staticResourceHandler=new StaticResourceHandler(resourceRoots);
    ResourceFactory resourceFactory=new ResourceFactoryImpl(staticResourceHandler);
    scanDynamicResources(cpResources,resourceFactory);
    File resourceOutputDir=new File(outputDir);
    if (!resourceOutputDir.exists()) {
      resourceOutputDir=new File(project.getBuild().getDirectory(),outputDir);
    }
    File resourceMappingDir=new File(project.getBuild().getOutputDirectory());
    ResourceHandler resourceHandler=new DynamicResourceHandler(staticResourceHandler,resourceFactory);
    faces=new FacesImpl(null,new FileNameMapperImpl(fileNameMappings),resourceHandler);
    faces.start();
    ResourceWriterImpl resourceWriter=new ResourceWriterImpl(resourceOutputDir,resourceMappingDir,getDefaultResourceProcessors(),getLog());
    ResourceTaskFactoryImpl taskFactory=new ResourceTaskFactoryImpl(faces);
    taskFactory.setResourceWriter(resourceWriter);
    executorService=createExecutorService();
    CompletionService<Object> completionService=new CountingExecutorCompletionService<Object>(executorService);
    taskFactory.setCompletionService(completionService);
    taskFactory.setSkins(skins);
    taskFactory.setLog(getLog());
    taskFactory.setFilter(createResourcesFilter());
    taskFactory.submit(foundResources);
    Future<Object> future=null;
    while (true) {
      future=completionService.take();
      if (future != null) {
        try {
          future.get();
        }
 catch (        ExecutionException e) {
          e.getCause().printStackTrace();
        }
      }
 else {
        break;
      }
    }
    resourceWriter.writeProcessedResourceMappings();
  }
 catch (  Exception e) {
    throw new MojoExecutionException(e.getMessage(),e);
  }
 finally {
    if (cpResources != null) {
      for (      VFSRoot vfsRoot : cpResources) {
        try {
          vfsRoot.close();
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
    }
    if (webResources != null) {
      for (      VFSRoot vfsRoot : webResources) {
        try {
          vfsRoot.close();
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
    }
    if (executorService != null) {
      executorService.shutdown();
    }
    if (faces != null) {
      faces.stop();
    }
    Thread.currentThread().setContextClassLoader(contextCL);
  }
}