Program: 90004
Project: 90004
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 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) {
    throw e;
  }
catch (  GenieException e) {
    if (jobStateService.jobExists(jobId)) {
      jobStateService.done(jobId);
      jobPersistenceService.updateJobStatus(jobId,jobStatus,e.getMessage());
    }
    throw e;
  }
catch (  Exception e) {
    if (jobStateService.jobExists(jobId)) {
      jobStateService.done(jobId);
      jobPersistenceService.updateJobStatus(jobId,jobStatus,e.getMessage());
    }
    throw new GenieServerException(e);
  }
 finally {
    this.coordinationTimer.record(System.nanoTime() - coordinationStart,TimeUnit.MILLISECONDS);
  }
}

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 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) {
    throw e;
  }
catch (  GenieException e) {
    if (jobStateService.jobExists(jobId)) {
      jobStateService.done(jobId);
      jobPersistenceService.updateJobStatus(jobId,jobStatus,e.getMessage());
    }
    throw e;
  }
catch (  Exception e) {
    if (jobStateService.jobExists(jobId)) {
      jobStateService.done(jobId);
      jobPersistenceService.updateJobStatus(jobId,jobStatus,e.getMessage());
    }
    throw new GenieServerException(e);
  }
 finally {
    this.coordinationTimer.record(System.nanoTime() - coordinationStart,TimeUnit.NANOSECONDS);
  }
}