Program: 5184
Project: 5184
Buggy source:
private BodyConsumer deployApplication(final HttpResponder responder,final NamespaceId namespace,final String appId,final String archiveName,final String configString,@Nullable final String ownerPrincipal) throws IOException {
  Id.Namespace idNamespace=namespace.toId();
  Location namespaceHomeLocation=namespacedLocationFactory.get(idNamespace);
  if (!namespaceHomeLocation.exists()) {
    String msg=String.format("String_Node_Str",namespaceHomeLocation,namespace.getNamespace());
    LOG.error(msg);
    responder.sendString(HttpResponseStatus.NOT_FOUND,msg);
    return null;
  }
  if (archiveName == null || archiveName.isEmpty()) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,String.format("String_Node_Str",ARCHIVE_NAME_HEADER),ImmutableMultimap.of(HttpHeaders.Names.CONNECTION,HttpHeaders.Values.CLOSE));
    return null;
  }
  final Id.Artifact artifactId;
  try {
    artifactId=Id.Artifact.parse(idNamespace,archiveName);
  }
 catch (  IllegalArgumentException e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
    return null;
  }
  KerberosPrincipalId ownerPrincipalId=ownerPrincipal == null ? null : new KerberosPrincipalId(ownerPrincipal);
  String namespacesDir=configuration.get(Constants.Namespace.NAMESPACES_DIR);
  File localDataDir=new File(configuration.get(Constants.CFG_LOCAL_DATA_DIR));
  File namespaceBase=new File(localDataDir,namespacesDir);
  File tempDir=new File(new File(namespaceBase,namespace.getNamespace()),configuration.get(Constants.AppFabric.TEMP_DIR)).getAbsoluteFile();
  if (!DirUtils.mkdirs(tempDir)) {
    throw new IOException("String_Node_Str" + tempDir);
  }
  final KerberosPrincipalId finalOwnerPrincipalId=ownerPrincipalId;
  return new AbstractBodyConsumer(File.createTempFile("String_Node_Str","String_Node_Str",tempDir)){
    @Override protected void onFinish(    HttpResponder responder,    File uploadedFile){
      try {
        ApplicationWithPrograms app=applicationLifecycleService.deployAppAndArtifact(namespace,appId,artifactId,uploadedFile,configString,finalOwnerPrincipalId,createProgramTerminator());
        LOG.info("String_Node_Str" + "String_Node_Str",app.getApplicationId().getApplication(),namespace.getNamespace(),artifactId,configString,finalOwnerPrincipalId);
        responder.sendString(HttpResponseStatus.OK,String.format("String_Node_Str",app.getApplicationId().getApplication()));
      }
 catch (      InvalidArtifactException e) {
        responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
      }
catch (      ArtifactAlreadyExistsException e) {
        responder.sendString(HttpResponseStatus.CONFLICT,String.format("String_Node_Str" + "String_Node_Str",artifactId));
      }
catch (      WriteConflictException e) {
        LOG.warn("String_Node_Str",artifactId,e);
        responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,"String_Node_Str" + "String_Node_Str");
      }
catch (      UnauthorizedException e) {
        responder.sendString(HttpResponseStatus.FORBIDDEN,e.getMessage());
      }
catch (      Exception e) {
        LOG.error("String_Node_Str",e);
        responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
      }
    }
  }
;
}

Fixed version (ground truth):
private BodyConsumer deployApplication(final HttpResponder responder,final NamespaceId namespace,final String appId,final String archiveName,final String configString,@Nullable final String ownerPrincipal) throws IOException {
  Id.Namespace idNamespace=namespace.toId();
  Location namespaceHomeLocation=namespacedLocationFactory.get(idNamespace);
  if (!namespaceHomeLocation.exists()) {
    String msg=String.format("String_Node_Str",namespaceHomeLocation,namespace.getNamespace());
    LOG.error(msg);
    responder.sendString(HttpResponseStatus.NOT_FOUND,msg);
    return null;
  }
  if (archiveName == null || archiveName.isEmpty()) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,String.format("String_Node_Str",ARCHIVE_NAME_HEADER),ImmutableMultimap.of(HttpHeaders.Names.CONNECTION,HttpHeaders.Values.CLOSE));
    return null;
  }
  final Id.Artifact artifactId;
  try {
    artifactId=Id.Artifact.parse(idNamespace,archiveName);
  }
 catch (  IllegalArgumentException e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
    return null;
  }
  KerberosPrincipalId ownerPrincipalId=ownerPrincipal == null ? null : new KerberosPrincipalId(ownerPrincipal);
  String namespacesDir=configuration.get(Constants.Namespace.NAMESPACES_DIR);
  File localDataDir=new File(configuration.get(Constants.CFG_LOCAL_DATA_DIR));
  File namespaceBase=new File(localDataDir,namespacesDir);
  File tempDir=new File(new File(namespaceBase,namespace.getNamespace()),configuration.get(Constants.AppFabric.TEMP_DIR)).getAbsoluteFile();
  if (!DirUtils.mkdirs(tempDir)) {
    throw new IOException("String_Node_Str" + tempDir);
  }
  final KerberosPrincipalId finalOwnerPrincipalId=ownerPrincipalId;
  return new AbstractBodyConsumer(File.createTempFile("String_Node_Str","String_Node_Str",tempDir)){
    @Override protected void onFinish(    HttpResponder responder,    File uploadedFile){
      try {
        ApplicationWithPrograms app=applicationLifecycleService.deployAppAndArtifact(namespace,appId,artifactId,uploadedFile,configString,finalOwnerPrincipalId,createProgramTerminator());
        LOG.info("String_Node_Str" + "String_Node_Str",app.getApplicationId().getApplication(),namespace.getNamespace(),artifactId,configString,finalOwnerPrincipalId);
        responder.sendString(HttpResponseStatus.OK,String.format("String_Node_Str",app.getApplicationId().getApplication()));
      }
 catch (      InvalidArtifactException e) {
        responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
      }
catch (      ArtifactAlreadyExistsException e) {
        responder.sendString(HttpResponseStatus.CONFLICT,String.format("String_Node_Str" + "String_Node_Str",artifactId));
      }
catch (      WriteConflictException e) {
        LOG.warn("String_Node_Str",artifactId,e);
        responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,"String_Node_Str" + "String_Node_Str");
      }
catch (      UnauthorizedException e) {
        responder.sendString(HttpResponseStatus.FORBIDDEN,e.getMessage());
      }
catch (      ConflictException e) {
        responder.sendString(HttpResponseStatus.CONFLICT,e.getMessage());
      }
catch (      Exception e) {
        LOG.error("String_Node_Str",e);
        responder.sendString(HttpResponseStatus.BAD_REQUEST,e.getMessage());
      }
    }
  }
;
}