Program: 155507
Project: 155507
Buggy source:
/** 
 * Execute the phase. Resources receive the phase command in position order (reversed or not). If there is more than once resource in a position, command is sent in enlistment order (again reversed or not). If   {@link bitronix.tm.Configuration#isAsynchronous2Pc()} is true, all commands in a given position are sentin parallel by using the detected  {@link Executor} implementation.
 * @param resourceManager the {@link XAResourceManager} containing the enlisted resources to execute the phase on.
 * @param reverse true if jobs should be executed in reverse position / enlistment order, false for natural position / enlistment order.
 * @throws PhaseException if one or more resource threw an exception during phase execution.
 * @see bitronix.tm.twopc.executor.SyncExecutor
 * @see bitronix.tm.twopc.executor.SimpleAsyncExecutor
 * @see bitronix.tm.twopc.executor.ConcurrentExecutor
 * @see bitronix.tm.twopc.executor.BackportConcurrentExecutor 
 */
protected void executePhase(XAResourceManager resourceManager,boolean reverse) throws PhaseException {
  SortedSet positions;
  if (reverse) {
    positions=resourceManager.getReverseOrderPositions();
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + resourceManager.size() + "String_Node_Str"+ positions.size()+ "String_Node_Str");
  }
 else {
    positions=resourceManager.getNaturalOrderPositions();
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + resourceManager.size() + "String_Node_Str"+ positions.size()+ "String_Node_Str");
  }
  Iterator it=positions.iterator();
  while (it.hasNext()) {
    Object positionKey=it.next();
    List resources;
    if (reverse) {
      resources=resourceManager.getReverseOrderResourcesForPosition(positionKey);
    }
 else {
      resources=resourceManager.getNaturalOrderResourcesForPosition(positionKey);
    }
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + resources.size() + "String_Node_Str"+ positionKey+ "String_Node_Str");
    runJobsForPosition(resources);
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + resources.size() + "String_Node_Str"+ positionKey+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Execute the phase. Resources receive the phase command in position order (reversed or not). If there is more than once resource in a position, command is sent in enlistment order (again reversed or not). If   {@link bitronix.tm.Configuration#isAsynchronous2Pc()} is true, all commands in a given position are sentin parallel by using the detected  {@link Executor} implementation.
 * @param resourceManager the {@link XAResourceManager} containing the enlisted resources to execute the phase on.
 * @param reverse true if jobs should be executed in reverse position / enlistment order, false for natural position / enlistment order.
 * @throws PhaseException if one or more resource threw an exception during phase execution.
 * @see bitronix.tm.twopc.executor.SyncExecutor
 * @see bitronix.tm.twopc.executor.SimpleAsyncExecutor
 * @see bitronix.tm.twopc.executor.ConcurrentExecutor
 * @see bitronix.tm.twopc.executor.BackportConcurrentExecutor 
 */
protected void executePhase(XAResourceManager resourceManager,boolean reverse) throws PhaseException {
  SortedSet positions;
  if (reverse) {
    positions=resourceManager.getReverseOrderPositions();
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + resourceManager.size() + "String_Node_Str"+ positions.size()+ "String_Node_Str");
  }
 else {
    positions=resourceManager.getNaturalOrderPositions();
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + resourceManager.size() + "String_Node_Str"+ positions.size()+ "String_Node_Str");
  }
  List positionErrorReports=new ArrayList();
  Iterator it=positions.iterator();
  while (it.hasNext()) {
    Object positionKey=it.next();
    List resources;
    if (reverse) {
      resources=resourceManager.getReverseOrderResourcesForPosition(positionKey);
    }
 else {
      resources=resourceManager.getNaturalOrderResourcesForPosition(positionKey);
    }
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + resources.size() + "String_Node_Str"+ positionKey+ "String_Node_Str");
    JobsExecutionReport report=runJobsForPosition(resources);
    if (report.getExceptions().size() > 0) {
      if (log.isDebugEnabled())       log.debug(report.getExceptions().size() + "String_Node_Str" + positionKey+ "String_Node_Str");
      positionErrorReports.add(report);
    }
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + resources.size() + "String_Node_Str"+ positionKey+ "String_Node_Str");
  }
  if (positionErrorReports.size() > 0) {
    List exceptions=new ArrayList();
    List resources=new ArrayList();
    for (int i=0; i < positionErrorReports.size(); i++) {
      JobsExecutionReport report=(JobsExecutionReport)positionErrorReports.get(i);
      exceptions.addAll(report.getExceptions());
      resources.addAll(report.getResources());
    }
    throw new PhaseException(exceptions,resources);
  }
}