Program: 61131
Project: 61131
Buggy source:
/** 
 * Implementation of the provisioning feature.
 * @param user
 * @param mandatoryResourceNames
 * @param merge
 * @throws PropagationException
 */
private void provision(final SyncopeUser user,final String password,final ResourceOperations resourceOperations,final Set<String> mandatoryResourceNames) throws PropagationException {
  LOG.debug("String_Node_Str",user,resourceOperations);
  resourceOperations.purge();
  LOG.debug("String_Node_Str",resourceOperations);
  Task task;
  TaskExecution execution;
  Long workflowId;
  for (  ResourceOperationType type : ResourceOperationType.values()) {
    for (    TargetResource resource : resourceOperations.get(type)) {
      Map<String,Set<Attribute>> preparedAttributes=prepareAttributes(user,password,resource);
      String accountId=preparedAttributes.keySet().iterator().next();
      task=new Task();
      task.setResource(resource);
      task.setResourceOperationType(type);
      task.setPropagationMode(mandatoryResourceNames.contains(resource.getName()) ? PropagationMode.SYNC : resource.getOptionalPropagationMode());
      task.setAccountId(accountId);
      task.setOldAccountId(resourceOperations.getOldAccountId());
      task.setAttributes(preparedAttributes.values().iterator().next());
      LOG.debug("String_Node_Str",task);
      task=taskDAO.save(task);
      execution=new TaskExecution();
      execution.setTask(task);
      try {
        workflowId=workflow.initialize(Constants.TASKEXECUTION_WORKFLOW,0,null);
        execution.setWorkflowId(workflowId);
      }
 catch (      WorkflowException e) {
        LOG.error("String_Node_Str",execution,e);
      }
      propagate(execution);
      LOG.debug("String_Node_Str",task);
      if (mandatoryResourceNames.contains(resource.getName()) && WFUtils.getTaskExecutionStatus(workflow,execution) != TaskExecutionStatus.SUCCESS) {
        throw new PropagationException(resource.getName(),execution.getMessage());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Implementation of the provisioning feature.
 * @param user
 * @param mandatoryResourceNames
 * @param merge
 * @throws PropagationException
 */
private void provision(final SyncopeUser user,final String password,final ResourceOperations resourceOperations,final Set<String> mandatoryResourceNames) throws PropagationException {
  LOG.debug("String_Node_Str",user,resourceOperations);
  resourceOperations.purge();
  LOG.debug("String_Node_Str",resourceOperations);
  Task task;
  TaskExecution execution;
  Long workflowId;
  for (  ResourceOperationType type : ResourceOperationType.values()) {
    for (    TargetResource resource : resourceOperations.get(type)) {
      Map<String,Set<Attribute>> preparedAttributes=prepareAttributes(user,password,resource);
      String accountId=preparedAttributes.keySet().iterator().next();
      task=new Task();
      task.setResource(resource);
      task.setResourceOperationType(type);
      task.setPropagationMode(mandatoryResourceNames.contains(resource.getName()) ? PropagationMode.SYNC : resource.getOptionalPropagationMode());
      task.setAccountId(accountId);
      task.setOldAccountId(resourceOperations.getOldAccountId(resource.getName()));
      task.setAttributes(preparedAttributes.values().iterator().next());
      LOG.debug("String_Node_Str",task);
      task=taskDAO.save(task);
      execution=new TaskExecution();
      execution.setTask(task);
      try {
        workflowId=workflow.initialize(Constants.TASKEXECUTION_WORKFLOW,0,null);
        execution.setWorkflowId(workflowId);
      }
 catch (      WorkflowException e) {
        LOG.error("String_Node_Str",execution,e);
      }
      propagate(execution);
      LOG.debug("String_Node_Str",task);
      if (mandatoryResourceNames.contains(resource.getName()) && WFUtils.getTaskExecutionStatus(workflow,execution) != TaskExecutionStatus.SUCCESS) {
        throw new PropagationException(resource.getName(),execution.getMessage());
      }
    }
  }
}