Program: 6206
Project: 6206
Buggy source:
/** 
 * Create a classloader that uses the artifact at the specified location to load classes, with access to packages that all program type has access to. The classloader created is only for artifact inspection purpose and shouldn't be used for program execution as it doesn't have the proper class filtering for the specific program type for the program being executed.
 * @param artifactLocation the location of the artifact to create the classloader from
 * @return a closeable classloader based off the specified artifact; on closing the returned {@link ClassLoader}, all temporary resources created for the classloader will be removed
 * @throws IOException if there was an error copying or unpacking the artifact
 */
CloseableClassLoader createClassLoader(Location artifactLocation) throws IOException {
  final File unpackDir=BundleJarUtil.unJar(artifactLocation,DirUtils.createTempDir(tmpDir));
  ClassLoader parentClassLoader;
  ProgramRuntimeProvider sparkRuntimeProvider=runtimeProviderLoader.get(ProgramType.SPARK);
  if (sparkRuntimeProvider != null) {
    parentClassLoader=new FilterClassLoader(sparkRuntimeProvider.getClass().getClassLoader(),sparkRuntimeProvider.createProgramClassLoaderFilter(ProgramType.SPARK));
  }
 else {
    parentClassLoader=new FilterClassLoader(getClass().getClassLoader(),FilterClassLoader.defaultFilter());
  }
  final ProgramClassLoader programClassLoader=new ProgramClassLoader(cConf,unpackDir,parentClassLoader);
  return new CloseableClassLoader(programClassLoader,new Closeable(){
    @Override public void close(){
      try {
        Closeables.closeQuietly(programClassLoader);
        DirUtils.deleteDirectoryContents(unpackDir);
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",unpackDir,e);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Create a classloader that uses the artifact at the specified location to load classes, with access to packages that all program type has access to. The classloader created is only for artifact inspection purpose and shouldn't be used for program execution as it doesn't have the proper class filtering for the specific program type for the program being executed.
 * @param artifactLocation the location of the artifact to create the classloader from
 * @return a closeable classloader based off the specified artifact; on closing the returned {@link ClassLoader}, all temporary resources created for the classloader will be removed
 * @throws IOException if there was an error copying or unpacking the artifact
 */
CloseableClassLoader createClassLoader(Location artifactLocation) throws IOException {
  final File unpackDir=BundleJarUtil.unJar(artifactLocation,DirUtils.createTempDir(tmpDir));
  ProgramClassLoader programClassLoader=null;
  try {
    ProgramRunner programRunner=programRunnerFactory.create(ProgramType.SPARK);
    if (programRunner instanceof ProgramClassLoaderProvider) {
      programClassLoader=((ProgramClassLoaderProvider)programRunner).createProgramClassLoader(cConf,unpackDir);
    }
  }
 catch (  Exception e) {
    LOG.trace("String_Node_Str",e);
  }
  if (programClassLoader == null) {
    programClassLoader=new ProgramClassLoader(cConf,unpackDir,FilterClassLoader.create(getClass().getClassLoader()));
  }
  final ProgramClassLoader finalProgramClassLoader=programClassLoader;
  return new CloseableClassLoader(programClassLoader,new Closeable(){
    @Override public void close(){
      try {
        Closeables.closeQuietly(finalProgramClassLoader);
        DirUtils.deleteDirectoryContents(unpackDir);
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",unpackDir,e);
      }
    }
  }
);
}