Program: 5487
Project: 5487
Buggy source:
/** 
 * Inspect the given artifact to determine the classes contained in the artifact.
 * @param artifactId the id of the artifact to inspect
 * @param artifactFile the artifact file
 * @param parentClassLoader the parent classloader to use when inspecting plugins contained in the artifact.For example, a ProgramClassLoader created from the artifact the input artifact extends
 * @return metadata about the classes contained in the artifact
 * @throws IOException if there was an exception opening the jar file
 * @throws InvalidArtifactException if the artifact is invalid. For example, if the application main class is notactually an Application.
 */
ArtifactClasses inspectArtifact(Id.Artifact artifactId,File artifactFile,@Nullable ClassLoader parentClassLoader) throws IOException, InvalidArtifactException {
  Path tmpDir=Paths.get(cConf.get(Constants.CFG_LOCAL_DATA_DIR),cConf.get(Constants.AppFabric.TEMP_DIR)).toAbsolutePath();
  Files.createDirectories(tmpDir);
  Location artifactLocation=Locations.toLocation(artifactFile);
  Path stageDir=Files.createTempDirectory(tmpDir,artifactFile.getName());
  try {
    File unpackedDir=BundleJarUtil.unJar(artifactLocation,Files.createTempDirectory(stageDir,"String_Node_Str").toFile());
    try (CloseableClassLoader artifactClassLoader=artifactClassLoaderFactory.createClassLoader(unpackedDir)){
      ArtifactClasses.Builder builder=inspectApplications(artifactId,ArtifactClasses.builder(),artifactLocation,artifactClassLoader);
      try (PluginInstantiator pluginInstantiator=new PluginInstantiator(cConf,parentClassLoader == null ? artifactClassLoader : parentClassLoader,Files.createTempDirectory(stageDir,"String_Node_Str").toFile())){
        pluginInstantiator.addArtifact(artifactLocation,artifactId.toArtifactId());
        inspectPlugins(builder,artifactFile,artifactId.toArtifactId(),pluginInstantiator);
      }
       return builder.build();
    }
   }
  finally {
    try {
      DirUtils.deleteDirectoryContents(stageDir.toFile());
    }
 catch (    IOException e) {
      LOG.warn("String_Node_Str",stageDir,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Inspect the given artifact to determine the classes contained in the artifact.
 * @param artifactId the id of the artifact to inspect
 * @param artifactFile the artifact file
 * @param parentClassLoader the parent classloader to use when inspecting plugins contained in the artifact.For example, a ProgramClassLoader created from the artifact the input artifact extends
 * @return metadata about the classes contained in the artifact
 * @throws IOException if there was an exception opening the jar file
 * @throws InvalidArtifactException if the artifact is invalid. For example, if the application main class is notactually an Application.
 */
ArtifactClasses inspectArtifact(Id.Artifact artifactId,File artifactFile,@Nullable ClassLoader parentClassLoader) throws IOException, InvalidArtifactException {
  Path tmpDir=Paths.get(cConf.get(Constants.CFG_LOCAL_DATA_DIR),cConf.get(Constants.AppFabric.TEMP_DIR)).toAbsolutePath();
  Files.createDirectories(tmpDir);
  Location artifactLocation=Locations.toLocation(artifactFile);
  Path stageDir=Files.createTempDirectory(tmpDir,artifactFile.getName());
  try {
    File unpackedDir=BundleJarUtil.unJar(artifactLocation,Files.createTempDirectory(stageDir,"String_Node_Str").toFile());
    try (CloseableClassLoader artifactClassLoader=artifactClassLoaderFactory.createClassLoader(unpackedDir)){
      ArtifactClasses.Builder builder=inspectApplications(artifactId,ArtifactClasses.builder(),artifactLocation,artifactClassLoader);
      try (PluginInstantiator pluginInstantiator=new PluginInstantiator(cConf,parentClassLoader == null ? artifactClassLoader : parentClassLoader,Files.createTempDirectory(stageDir,"String_Node_Str").toFile())){
        pluginInstantiator.addArtifact(artifactLocation,artifactId.toArtifactId());
        inspectPlugins(builder,artifactFile,artifactId.toArtifactId(),pluginInstantiator);
      }
       return builder.build();
    }
   }
 catch (  EOFException|ZipException e) {
    throw new InvalidArtifactException("String_Node_Str" + artifactId + "String_Node_Str",e);
  }
 finally {
    try {
      DirUtils.deleteDirectoryContents(stageDir.toFile());
    }
 catch (    IOException e) {
      LOG.warn("String_Node_Str",stageDir,e);
    }
  }
}