Program: 29718
Project: 29718
Buggy source:
/** 
 * This method populates the Application object from a ReadableArchive
 * @param archive the archive for the application
 */
public Application processDeploymentMetaData(ReadableArchive archive) throws Exception {
  FileArchive expandedArchive=null;
  File tmpFile=null;
  ExtendedDeploymentContext context=null;
  Logger logger=Logger.getAnonymousLogger();
  ClassLoader cl=null;
  try {
    String archiveName=Util.getURIName(archive.getURI());
    ArchiveHandler archiveHandler=deployment.getArchiveHandler(archive);
    if (archiveHandler == null) {
      throw new IllegalArgumentException(localStrings.getLocalString("String_Node_Str","String_Node_Str",archiveName));
    }
    DeployCommandParameters parameters=new DeployCommandParameters(new File(archive.getURI()));
    ActionReport report=new HTMLActionReporter();
    context=new DeploymentContextImpl(report,logger,archive,parameters,env);
    context.setArchiveHandler(archiveHandler);
    String appName=archiveHandler.getDefaultApplicationName(archive,context);
    parameters.name=appName;
    if (archive instanceof InputJarArchive) {
      tmpFile=File.createTempFile(archiveName,"String_Node_Str");
      String path=tmpFile.getAbsolutePath();
      if (!tmpFile.delete()) {
        logger.log(Level.WARNING,"String_Node_Str",new Object[]{path});
      }
      File tmpDir=new File(path);
      tmpDir.deleteOnExit();
      tmpDir.mkdirs();
      expandedArchive=(FileArchive)archiveFactory.createArchive(tmpDir);
      archiveHandler.expand(archive,expandedArchive,context);
      context.setSource(expandedArchive);
    }
    context.setPhase(DeploymentContextImpl.Phase.PREPARE);
    ClassLoaderHierarchy clh=clhProvider.get();
    context.createDeploymentClassLoader(clh,archiveHandler);
    cl=context.getClassLoader();
    deployment.getDeployableTypes(context);
    deployment.getSniffers(archiveHandler,null,context);
    return processDOL(context);
  }
  finally {
    if (cl != null) {
      try {
        PreDestroy.class.cast(cl).preDestroy();
      }
 catch (      Exception e) {
      }
    }
    if (context != null) {
      context.postDeployClean(true);
    }
    if (expandedArchive != null) {
      try {
        expandedArchive.close();
      }
 catch (      Exception e) {
      }
    }
    if (tmpFile != null && tmpFile.exists()) {
      try {
        FileUtils.whack(tmpFile);
      }
 catch (      Exception e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * This method populates the Application object from a ReadableArchive
 * @param archive the archive for the application
 */
public Application processDeploymentMetaData(ReadableArchive archive) throws Exception {
  FileArchive expandedArchive=null;
  File tmpFile=null;
  ExtendedDeploymentContext context=null;
  Logger logger=Logger.getAnonymousLogger();
  ClassLoader cl=null;
  try {
    String archiveName=Util.getURIName(archive.getURI());
    ArchiveHandler archiveHandler=deployment.getArchiveHandler(archive);
    if (archiveHandler == null) {
      throw new IllegalArgumentException(localStrings.getLocalString("String_Node_Str","String_Node_Str",archiveName));
    }
    DeployCommandParameters parameters=new DeployCommandParameters(new File(archive.getURI()));
    ActionReport report=new HTMLActionReporter();
    context=new DeploymentContextImpl(report,logger,archive,parameters,env);
    context.setArchiveHandler(archiveHandler);
    String appName=archiveHandler.getDefaultApplicationName(archive,context);
    parameters.name=appName;
    if (archive instanceof InputJarArchive) {
      tmpFile=File.createTempFile(archiveName,"String_Node_Str");
      String path=tmpFile.getAbsolutePath();
      if (!tmpFile.delete()) {
        logger.log(Level.WARNING,"String_Node_Str",new Object[]{path});
      }
      File tmpDir=new File(path);
      tmpDir.deleteOnExit();
      tmpDir.mkdirs();
      expandedArchive=(FileArchive)archiveFactory.createArchive(tmpDir);
      archiveHandler.expand(archive,expandedArchive,context);
      context.setSource(expandedArchive);
    }
    context.setPhase(DeploymentContextImpl.Phase.PREPARE);
    ClassLoaderHierarchy clh=clhProvider.get();
    context.createDeploymentClassLoader(clh,archiveHandler);
    cl=context.getClassLoader();
    deployment.getDeployableTypes(context);
    deployment.getSniffers(archiveHandler,null,context);
    return processDOL(context);
  }
  finally {
    if (cl != null && cl instanceof PreDestroy) {
      try {
        PreDestroy.class.cast(cl).preDestroy();
      }
 catch (      Exception e) {
      }
    }
    if (context != null) {
      context.postDeployClean(true);
    }
    if (expandedArchive != null) {
      try {
        expandedArchive.close();
      }
 catch (      Exception e) {
      }
    }
    if (tmpFile != null && tmpFile.exists()) {
      try {
        FileUtils.whack(tmpFile);
      }
 catch (      Exception e) {
      }
    }
  }
}