Program: 88199
Project: 88199
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void schedulJob(final ExecutionGraph executionGraph) throws SchedulingException {
  final Map<InstanceType,InstanceTypeDescription> availableInstances=getInstanceManager().getMapOfAvailableInstanceTypes();
  for (int i=0; i < executionGraph.getNumberOfStages(); i++) {
    final Map<InstanceType,Integer> requiredInstanceTypes=new HashMap<InstanceType,Integer>();
    final ExecutionStage stage=executionGraph.getStage(i);
    stage.collectRequiredInstanceTypes(requiredInstanceTypes,ExecutionState.CREATED);
    final Iterator<Map.Entry<InstanceType,Integer>> it=requiredInstanceTypes.entrySet().iterator();
    while (it.hasNext()) {
      final Map.Entry<InstanceType,Integer> entry=it.next();
      final InstanceTypeDescription descr=availableInstances.get(entry.getKey());
      if (descr == null) {
        throw new SchedulingException("String_Node_Str" + entry.getKey() + "String_Node_Str");
      }
      if (descr.getMaximumNumberOfAvailableInstances() != -1 && descr.getMaximumNumberOfAvailableInstances() < entry.getValue().intValue()) {
        throw new SchedulingException("String_Node_Str" + entry.getValue().intValue() + "String_Node_Str"+ entry.getKey()+ "String_Node_Str"+ descr.getMaximumNumberOfAvailableInstances()+ "String_Node_Str");
      }
    }
  }
  executionGraph.registerJobStatusListener(this);
  final ExecutionGraphIterator it2=new ExecutionGraphIterator(executionGraph,true);
  while (it2.hasNext()) {
    final ExecutionVertex vertex=it2.next();
    if (vertex.getExecutionState() != ExecutionState.CREATED) {
      LOG.error("String_Node_Str" + vertex + "String_Node_Str"+ vertex.getExecutionState()+ "String_Node_Str"+ ExecutionState.CREATED);
    }
    vertex.getEnvironment().registerExecutionListener(new QueueExecutionListener(this,vertex));
    vertex.setExecutionState(ExecutionState.SCHEDULED);
  }
  executionGraph.registerExecutionStageListener(this);
  final ExecutionStage executionStage=executionGraph.getCurrentExecutionStage();
  try {
    requestInstances(executionStage);
  }
 catch (  InstanceException e) {
    throw new SchedulingException(StringUtils.stringifyException(e));
  }
synchronized (this.jobQueue) {
    this.jobQueue.add(executionGraph);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void schedulJob(final ExecutionGraph executionGraph) throws SchedulingException {
  final Map<InstanceType,InstanceTypeDescription> availableInstances=getInstanceManager().getMapOfAvailableInstanceTypes();
  for (int i=0; i < executionGraph.getNumberOfStages(); i++) {
    final Map<InstanceType,Integer> requiredInstanceTypes=new HashMap<InstanceType,Integer>();
    final ExecutionStage stage=executionGraph.getStage(i);
    stage.collectRequiredInstanceTypes(requiredInstanceTypes,ExecutionState.CREATED);
    final Iterator<Map.Entry<InstanceType,Integer>> it=requiredInstanceTypes.entrySet().iterator();
    while (it.hasNext()) {
      final Map.Entry<InstanceType,Integer> entry=it.next();
      final InstanceTypeDescription descr=availableInstances.get(entry.getKey());
      if (descr == null) {
        throw new SchedulingException("String_Node_Str" + entry.getKey() + "String_Node_Str");
      }
      if (descr.getMaximumNumberOfAvailableInstances() != -1 && descr.getMaximumNumberOfAvailableInstances() < entry.getValue().intValue()) {
        throw new SchedulingException("String_Node_Str" + entry.getValue().intValue() + "String_Node_Str"+ entry.getKey()+ "String_Node_Str"+ descr.getMaximumNumberOfAvailableInstances()+ "String_Node_Str");
      }
    }
  }
  executionGraph.registerJobStatusListener(this);
  final ExecutionGraphIterator it2=new ExecutionGraphIterator(executionGraph,true);
  while (it2.hasNext()) {
    final ExecutionVertex vertex=it2.next();
    if (vertex.getExecutionState() != ExecutionState.CREATED) {
      LOG.error("String_Node_Str" + vertex + "String_Node_Str"+ vertex.getExecutionState()+ "String_Node_Str"+ ExecutionState.CREATED);
    }
    vertex.getEnvironment().registerExecutionListener(new QueueExecutionListener(this,vertex));
    vertex.setExecutionState(ExecutionState.SCHEDULED);
  }
  executionGraph.registerExecutionStageListener(this);
synchronized (this.jobQueue) {
    this.jobQueue.add(executionGraph);
  }
  final ExecutionStage executionStage=executionGraph.getCurrentExecutionStage();
  try {
    requestInstances(executionStage);
  }
 catch (  InstanceException e) {
    LOG.error(StringUtils.stringifyException(e));
  }
}