Program: 7410
Project: 7410
Buggy source:
private BodyConsumer deployAppStream(final HttpRequest request,final HttpResponder responder,final String namespaceId,final String appId) throws IOException {
  validateNamespace(namespaceId,responder);
  final String archiveName=request.getHeader(ARCHIVE_NAME_HEADER);
  if (archiveName == null || archiveName.isEmpty()) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,ARCHIVE_NAME_HEADER + "String_Node_Str",ImmutableMultimap.of(HttpHeaders.Names.CONNECTION,HttpHeaders.Values.CLOSE));
    return null;
  }
  File tempDir=new File(configuration.get(Constants.CFG_LOCAL_DATA_DIR),configuration.get(Constants.AppFabric.TEMP_DIR)).getAbsoluteFile();
  if (!DirUtils.mkdirs(tempDir)) {
    throw new IOException("String_Node_Str" + tempDir);
  }
  final Location archiveDir=locationFactory.create(this.archiveDir).append(namespaceId);
  final Location archive=archiveDir.append(archiveName);
  final SessionInfo sessionInfo=new SessionInfo(namespaceId,appId,archiveName,archive,DeployStatus.UPLOADING);
  sessions.put(namespaceId,sessionInfo);
  return new AbstractBodyConsumer(File.createTempFile("String_Node_Str","String_Node_Str",tempDir)){
    @Override protected void onFinish(    HttpResponder responder,    File uploadedFile){
      try {
        Locations.mkdirsIfNotExists(archiveDir);
        Location tmpLocation=archive.getTempFile("String_Node_Str");
        try {
          LOG.debug("String_Node_Str",uploadedFile,tmpLocation.toURI());
          Files.copy(uploadedFile,Locations.newOutputSupplier(tmpLocation));
          if (tmpLocation.renameTo(archive) == null) {
            throw new IOException(String.format("String_Node_Str",tmpLocation.toURI(),archive.toURI()));
          }
        }
 catch (        IOException e) {
          tmpLocation.delete();
          throw e;
        }
        sessionInfo.setStatus(DeployStatus.VERIFYING);
        deploy(namespaceId,appId,archive);
        sessionInfo.setStatus(DeployStatus.DEPLOYED);
        responder.sendString(HttpResponseStatus.OK,"String_Node_Str");
      }
 catch (      Exception e) {
        sessionInfo.setStatus(DeployStatus.FAILED);
        LOG.error("String_Node_Str",e);
        responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
      }
 finally {
        saveSessionInfo(sessionInfo.setStatus(sessionInfo.getStatus()),namespaceId);
        sessions.remove(namespaceId);
      }
    }
  }
;
}

Fixed version (ground truth):
private BodyConsumer deployAppStream(final HttpRequest request,final HttpResponder responder,final String namespaceId,final String appId) throws IOException {
  if (!namespaceExists(namespaceId)) {
    LOG.warn("String_Node_Str",namespaceId);
    responder.sendString(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str" + "String_Node_Str",namespaceId));
    return null;
  }
  final String archiveName=request.getHeader(ARCHIVE_NAME_HEADER);
  if (archiveName == null || archiveName.isEmpty()) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,ARCHIVE_NAME_HEADER + "String_Node_Str",ImmutableMultimap.of(HttpHeaders.Names.CONNECTION,HttpHeaders.Values.CLOSE));
    return null;
  }
  File tempDir=new File(configuration.get(Constants.CFG_LOCAL_DATA_DIR),configuration.get(Constants.AppFabric.TEMP_DIR)).getAbsoluteFile();
  if (!DirUtils.mkdirs(tempDir)) {
    throw new IOException("String_Node_Str" + tempDir);
  }
  final Location archiveDir=locationFactory.create(this.archiveDir).append(namespaceId);
  final Location archive=archiveDir.append(archiveName);
  final SessionInfo sessionInfo=new SessionInfo(namespaceId,appId,archiveName,archive,DeployStatus.UPLOADING);
  sessions.put(namespaceId,sessionInfo);
  return new AbstractBodyConsumer(File.createTempFile("String_Node_Str","String_Node_Str",tempDir)){
    @Override protected void onFinish(    HttpResponder responder,    File uploadedFile){
      try {
        Locations.mkdirsIfNotExists(archiveDir);
        Location tmpLocation=archive.getTempFile("String_Node_Str");
        try {
          LOG.debug("String_Node_Str",uploadedFile,tmpLocation.toURI());
          Files.copy(uploadedFile,Locations.newOutputSupplier(tmpLocation));
          if (tmpLocation.renameTo(archive) == null) {
            throw new IOException(String.format("String_Node_Str",tmpLocation.toURI(),archive.toURI()));
          }
        }
 catch (        IOException e) {
          tmpLocation.delete();
          throw e;
        }
        sessionInfo.setStatus(DeployStatus.VERIFYING);
        deploy(namespaceId,appId,archive);
        sessionInfo.setStatus(DeployStatus.DEPLOYED);
        responder.sendString(HttpResponseStatus.OK,"String_Node_Str");
      }
 catch (      Exception e) {
        sessionInfo.setStatus(DeployStatus.FAILED);
        LOG.error("String_Node_Str",e);
        responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
      }
 finally {
        saveSessionInfo(sessionInfo.setStatus(sessionInfo.getStatus()),namespaceId);
        sessions.remove(namespaceId);
      }
    }
  }
;
}