Program: 90149
Project: 90149
Buggy source:
/** 
 * {@inheritDoc}
 * @throws GenieException
 */
@Override public Job submitJob(final Job job) throws GenieException {
  LOG.debug("String_Node_Str");
  if (job == null) {
    throw new GenieException(HttpURLConnection.HTTP_BAD_REQUEST,"String_Node_Str");
  }
  job.validate();
  job.setJobStatus(JobStatus.INIT,"String_Node_Str");
  final Job savedJob;
  final int maxRunningJobs=CONF.getInt("String_Node_Str",0);
  final int jobForwardThreshold=CONF.getInt("String_Node_Str",0);
  final int maxIdleHostThreshold=CONF.getInt("String_Node_Str",0);
  final int idleHostThresholdDelta=CONF.getInt("String_Node_Str",0);
synchronized (this) {
    final int numRunningJobs=this.jobCountManager.getNumInstanceJobs();
    LOG.info("String_Node_Str" + numRunningJobs);
    int idleHostThreshold=numRunningJobs - idleHostThresholdDelta;
    if ((idleHostThreshold > maxIdleHostThreshold) || (numRunningJobs >= maxRunningJobs)) {
      idleHostThreshold=maxIdleHostThreshold;
    }
    if (numRunningJobs >= jobForwardThreshold && !job.isForwarded()) {
      LOG.info("String_Node_Str");
      final String idleHost=this.jobCountManager.getIdleInstance(idleHostThreshold);
      if (!idleHost.equals(NetUtil.getHostName())) {
        job.setForwarded(true);
        this.stats.incrGenieForwardedJobs();
        return forwardJobRequest("String_Node_Str" + idleHost + "String_Node_Str"+ SERVER_PORT+ "String_Node_Str"+ JOB_RESOURCE_PREFIX,job);
      }
    }
    if (numRunningJobs >= maxRunningJobs) {
      throw new GenieException(HttpURLConnection.HTTP_UNAVAILABLE,"String_Node_Str" + maxRunningJobs + "String_Node_Str");
    }
    buildJobURIs(job);
    try {
      savedJob=this.jobRepo.save(job);
    }
 catch (    final RollbackException e) {
      LOG.error("String_Node_Str",e);
      if (e.getCause() instanceof EntityExistsException) {
        throw new GenieException(HttpURLConnection.HTTP_CONFLICT,"String_Node_Str" + job.getId());
      }
 else {
        throw new GenieException(HttpURLConnection.HTTP_INTERNAL_ERROR,e);
      }
    }
  }
  if (savedJob == null) {
    throw new GenieException(HttpURLConnection.HTTP_INTERNAL_ERROR,"String_Node_Str");
  }
  this.stats.incrGenieJobSubmissions();
  try {
    this.jobManagerFactory.getJobManager(savedJob).launch();
    savedJob.setUpdated(new Date());
    return savedJob;
  }
 catch (  final GenieException e) {
    LOG.error("String_Node_Str",e);
    savedJob.setJobStatus(JobStatus.FAILED,e.getMessage());
    this.stats.incrGenieFailedJobs();
    return savedJob;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @throws GenieException
 */
@Override public Job submitJob(final Job job) throws GenieException {
  LOG.debug("String_Node_Str");
  if (job == null) {
    throw new GenieException(HttpURLConnection.HTTP_BAD_REQUEST,"String_Node_Str");
  }
  job.validate();
  job.setJobStatus(JobStatus.INIT,"String_Node_Str");
  final Job savedJob;
  final int maxRunningJobs=CONF.getInt("String_Node_Str",0);
  final int jobForwardThreshold=CONF.getInt("String_Node_Str",0);
  final int maxIdleHostThreshold=CONF.getInt("String_Node_Str",0);
  final int idleHostThresholdDelta=CONF.getInt("String_Node_Str",0);
synchronized (this) {
    final int numRunningJobs=this.jobCountManager.getNumInstanceJobs();
    LOG.info("String_Node_Str" + numRunningJobs);
    int idleHostThreshold=numRunningJobs - idleHostThresholdDelta;
    if ((idleHostThreshold > maxIdleHostThreshold) || (numRunningJobs >= maxRunningJobs)) {
      idleHostThreshold=maxIdleHostThreshold;
    }
    if (numRunningJobs >= jobForwardThreshold && !job.isForwarded()) {
      LOG.info("String_Node_Str");
      final String idleHost=this.jobCountManager.getIdleInstance(idleHostThreshold);
      if (!idleHost.equals(NetUtil.getHostName())) {
        job.setForwarded(true);
        this.stats.incrGenieForwardedJobs();
        return forwardJobRequest("String_Node_Str" + idleHost + "String_Node_Str"+ SERVER_PORT+ "String_Node_Str"+ JOB_RESOURCE_PREFIX,job);
      }
    }
    if (numRunningJobs >= maxRunningJobs) {
      throw new GenieException(HttpURLConnection.HTTP_UNAVAILABLE,"String_Node_Str" + maxRunningJobs + "String_Node_Str");
    }
    try {
      savedJob=this.jobRepo.save(job);
      buildJobURIs(savedJob);
    }
 catch (    final RollbackException e) {
      LOG.error("String_Node_Str",e);
      if (e.getCause() instanceof EntityExistsException) {
        throw new GenieException(HttpURLConnection.HTTP_CONFLICT,"String_Node_Str" + job.getId());
      }
 else {
        throw new GenieException(HttpURLConnection.HTTP_INTERNAL_ERROR,e);
      }
    }
  }
  if (savedJob == null) {
    throw new GenieException(HttpURLConnection.HTTP_INTERNAL_ERROR,"String_Node_Str");
  }
  this.stats.incrGenieJobSubmissions();
  try {
    this.jobManagerFactory.getJobManager(savedJob).launch();
    savedJob.setUpdated(new Date());
    return savedJob;
  }
 catch (  final GenieException e) {
    LOG.error("String_Node_Str",e);
    savedJob.setJobStatus(JobStatus.FAILED,e.getMessage());
    this.stats.incrGenieFailedJobs();
    return savedJob;
  }
}