Program: 89990
Project: 89990
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public String coordinateJob(@Valid @NotNull(message="String_Node_Str") final JobRequest jobRequest,@Valid @NotNull(message="String_Node_Str") final JobMetadata jobMetadata) throws GenieException {
  final long coordinationStart=System.nanoTime();
  final Map<String,String> tags=MetricsUtils.newSuccessTagsMap();
  final String jobId=jobRequest.getId().orElseThrow(() -> new GenieServerException("String_Node_Str"));
  JobStatus jobStatus=JobStatus.FAILED;
  try {
    log.info("String_Node_Str",jobId);
    final Job.Builder jobBuilder=new Job.Builder(jobRequest.getName(),jobRequest.getUser(),jobRequest.getVersion(),jobRequest.getCommandArgs()).withId(jobId).withTags(jobRequest.getTags()).withStatus(JobStatus.INIT).withStatusMsg("String_Node_Str");
    jobRequest.getDescription().ifPresent(jobBuilder::withDescription);
    if (!jobRequest.isDisableLogArchival()) {
      jobBuilder.withArchiveLocation(this.jobsProperties.getLocations().getArchives() + JobConstants.FILE_PATH_DELIMITER + jobId+ "String_Node_Str");
    }
    final JobExecution jobExecution=new JobExecution.Builder(this.hostName).withId(jobId).build();
    this.jobPersistenceService.createJob(jobRequest,jobMetadata,jobBuilder.build(),jobExecution);
    jobStateService.init(jobId);
    final Cluster cluster=this.getCluster(jobRequest);
    final Command command=this.getCommand(jobRequest,cluster);
    final List<Application> applications=this.getApplications(jobRequest,command);
    final int memory=jobRequest.getMemory().orElse(command.getMemory().orElse(this.jobsProperties.getMemory().getDefaultJobMemory()));
    this.setRuntimeEnvironment(jobId,cluster,command,applications,memory);
    final int maxJobMemory=this.jobsProperties.getMemory().getMaxJobMemory();
    if (memory > maxJobMemory) {
      jobStatus=JobStatus.INVALID;
      throw new GeniePreconditionException("String_Node_Str" + memory + "String_Node_Str"+ maxJobMemory+ "String_Node_Str");
    }
    log.info("String_Node_Str",jobRequest.getId(),jobRequest.getUser());
    final JobsUsersActiveLimitProperties activeLimit=this.jobsProperties.getUsers().getActiveLimit();
    if (activeLimit.isEnabled()) {
      final long activeJobsLimit=activeLimit.getCount();
      final long activeJobsCount=this.jobSearchService.getActiveJobCountForUser(jobRequest.getUser());
      if (activeJobsCount >= activeJobsLimit) {
        throw GenieUserLimitExceededException.createForActiveJobsLimit(jobRequest.getUser(),activeJobsCount,activeJobsLimit);
      }
    }
synchronized (this) {
      log.info("String_Node_Str",jobRequest.getId());
      final int maxSystemMemory=this.jobsProperties.getMemory().getMaxSystemMemory();
      final int usedMemory=this.jobStateService.getUsedMemory();
      if (usedMemory + memory <= maxSystemMemory) {
        log.info("String_Node_Str",jobId,usedMemory,maxSystemMemory,memory);
        log.info("String_Node_Str",jobId);
        jobStateService.schedule(jobId,jobRequest,cluster,command,applications,memory);
        return jobId;
      }
 else {
        throw new GenieServerUnavailableException("String_Node_Str" + jobId + "String_Node_Str"+ usedMemory+ "String_Node_Str"+ maxSystemMemory+ "String_Node_Str"+ memory+ "String_Node_Str");
      }
    }
  }
 catch (  GenieConflictException e) {
    MetricsUtils.addFailureTagsWithException(tags,e);
    throw e;
  }
catch (  GenieException e) {
    MetricsUtils.addFailureTagsWithException(tags,e);
    if (jobStateService.jobExists(jobId)) {
      jobStateService.done(jobId);
      jobPersistenceService.updateJobStatus(jobId,jobStatus,e.getMessage());
    }
    throw e;
  }
catch (  Exception e) {
    MetricsUtils.addFailureTagsWithException(tags,e);
    if (jobStateService.jobExists(jobId)) {
      jobStateService.done(jobId);
      jobPersistenceService.updateJobStatus(jobId,jobStatus,e.getMessage());
    }
    throw new GenieServerException("String_Node_Str",e);
  }
catch (  Throwable t) {
    MetricsUtils.addFailureTagsWithException(tags,t);
    throw t;
  }
 finally {
    this.registry.timer(this.coordinationTimerId.withTags(tags)).record(System.nanoTime() - coordinationStart,TimeUnit.NANOSECONDS);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public String coordinateJob(@Valid @NotNull(message="String_Node_Str") final JobRequest jobRequest,@Valid @NotNull(message="String_Node_Str") final JobMetadata jobMetadata) throws GenieException {
  final long coordinationStart=System.nanoTime();
  final Map<String,String> tags=MetricsUtils.newSuccessTagsMap();
  final String jobId=jobRequest.getId().orElseThrow(() -> new GenieServerException("String_Node_Str"));
  JobStatus jobStatus=JobStatus.FAILED;
  try {
    log.info("String_Node_Str",jobId);
    final Job.Builder jobBuilder=new Job.Builder(jobRequest.getName(),jobRequest.getUser(),jobRequest.getVersion(),jobRequest.getCommandArgs()).withId(jobId).withTags(jobRequest.getTags()).withStatus(JobStatus.INIT).withStatusMsg("String_Node_Str");
    jobRequest.getDescription().ifPresent(jobBuilder::withDescription);
    if (!jobRequest.isDisableLogArchival()) {
      jobBuilder.withArchiveLocation(this.jobsProperties.getLocations().getArchives() + JobConstants.FILE_PATH_DELIMITER + jobId+ "String_Node_Str");
    }
    final JobExecution jobExecution=new JobExecution.Builder(this.hostName).withId(jobId).build();
    this.jobPersistenceService.createJob(jobRequest,jobMetadata,jobBuilder.build(),jobExecution);
    this.jobStateService.init(jobId);
    final Cluster cluster=this.getCluster(jobRequest);
    final Command command=this.getCommand(jobRequest,cluster);
    final List<Application> applications=this.getApplications(jobRequest,command);
    final int memory=jobRequest.getMemory().orElse(command.getMemory().orElse(this.jobsProperties.getMemory().getDefaultJobMemory()));
    this.setRuntimeEnvironment(jobId,cluster,command,applications,memory);
    final int maxJobMemory=this.jobsProperties.getMemory().getMaxJobMemory();
    if (memory > maxJobMemory) {
      jobStatus=JobStatus.INVALID;
      throw new GeniePreconditionException("String_Node_Str" + memory + "String_Node_Str"+ maxJobMemory+ "String_Node_Str");
    }
    log.info("String_Node_Str",jobRequest.getId(),jobRequest.getUser());
    final JobsUsersActiveLimitProperties activeLimit=this.jobsProperties.getUsers().getActiveLimit();
    if (activeLimit.isEnabled()) {
      final long activeJobsLimit=activeLimit.getCount();
      final long activeJobsCount=this.jobSearchService.getActiveJobCountForUser(jobRequest.getUser());
      if (activeJobsCount >= activeJobsLimit) {
        throw GenieUserLimitExceededException.createForActiveJobsLimit(jobRequest.getUser(),activeJobsCount,activeJobsLimit);
      }
    }
synchronized (this) {
      log.info("String_Node_Str",jobRequest.getId());
      final int maxSystemMemory=this.jobsProperties.getMemory().getMaxSystemMemory();
      final int usedMemory=this.jobStateService.getUsedMemory();
      if (usedMemory + memory <= maxSystemMemory) {
        log.info("String_Node_Str",jobId,usedMemory,maxSystemMemory,memory);
        log.info("String_Node_Str",jobId);
        this.jobStateService.schedule(jobId,jobRequest,cluster,command,applications,memory);
        return jobId;
      }
 else {
        throw new GenieServerUnavailableException("String_Node_Str" + jobId + "String_Node_Str"+ usedMemory+ "String_Node_Str"+ maxSystemMemory+ "String_Node_Str"+ memory+ "String_Node_Str");
      }
    }
  }
 catch (  final GenieConflictException e) {
    MetricsUtils.addFailureTagsWithException(tags,e);
    throw e;
  }
catch (  final GenieException e) {
    MetricsUtils.addFailureTagsWithException(tags,e);
    if (this.jobStateService.jobExists(jobId)) {
      this.jobStateService.done(jobId);
      this.jobPersistenceService.updateJobStatus(jobId,jobStatus,e.getMessage());
    }
    throw e;
  }
catch (  final Exception e) {
    MetricsUtils.addFailureTagsWithException(tags,e);
    if (this.jobStateService.jobExists(jobId)) {
      this.jobStateService.done(jobId);
      this.jobPersistenceService.updateJobStatus(jobId,jobStatus,e.getMessage());
    }
    throw new GenieServerException("String_Node_Str",e);
  }
catch (  final Throwable t) {
    MetricsUtils.addFailureTagsWithException(tags,t);
    throw t;
  }
 finally {
    this.registry.timer(this.coordinationTimerId.withTags(tags)).record(System.nanoTime() - coordinationStart,TimeUnit.NANOSECONDS);
  }
}