Program: 60800
Project: 60800
Buggy source:
/** 
 * Performs update on each resource associated to the user.
 * @param userId to be updated
 * @param password to be updated
 * @param vAttrsToBeRemoved virtual attributes to be removed
 * @param vAttrsToBeUpdated virtual attributes to be added
 * @param enable wether user must be enabled or not
 * @param propByRes operations to perform on each resource
 * @param syncResourceName name of external resource performing sync, hencenot to be considered for propagation
 * @return list of propagation tasks
 * @throws NotFoundException if userId is not found
 */
public List<PropagationTask> getUpdateTaskIds(final Long userId,final String password,final Set<String> vAttrsToBeRemoved,final Set<AttributeMod> vAttrsToBeUpdated,final Boolean enable,final PropagationByResource propByRes,final String syncResourceName) throws NotFoundException {
  SyncopeUser user=getSyncopeUser(userId);
  Set<String> vAttrsToRemove=vAttrsToBeRemoved == null ? Collections.EMPTY_SET : vAttrsToBeRemoved;
  Set<AttributeMod> vAttrsToUpdate=vAttrsToBeUpdated == null ? Collections.EMPTY_SET : vAttrsToBeUpdated;
  PropagationByResource localPropByRes=userDataBinder.fillVirtual(user,vAttrsToRemove,vAttrsToUpdate,AttributableUtil.USER);
  if (propByRes != null && !propByRes.isEmpty()) {
    localPropByRes.merge(propByRes);
  }
 else {
    localPropByRes.addAll(PropagationOperation.UPDATE,user.getExternalResourceNames());
  }
  if (syncResourceName != null) {
    localPropByRes.get(PropagationOperation.CREATE).remove(syncResourceName);
    localPropByRes.get(PropagationOperation.UPDATE).remove(syncResourceName);
    localPropByRes.get(PropagationOperation.DELETE).remove(syncResourceName);
  }
  return provision(user,password,enable,localPropByRes);
}

Fixed version (ground truth):
/** 
 * Performs update on each resource associated to the user.
 * @param wfResult user to be propagated (and info associated), as perresult from workflow
 * @param password to be updated
 * @param vAttrsToBeRemoved virtual attributes to be removed
 * @param vAttrsToBeUpdated virtual attributes to be added
 * @param enable wether user must be enabled or not
 * @param syncResourceName name of external resource performing sync, hencenot to be considered for propagation
 * @return list of propagation tasks
 * @throws NotFoundException if userId is not found
 */
public List<PropagationTask> getUpdateTaskIds(final WorkflowResult<Long> wfResult,final String password,final Set<String> vAttrsToBeRemoved,final Set<AttributeMod> vAttrsToBeUpdated,final Boolean enable,final String syncResourceName) throws NotFoundException {
  SyncopeUser user=getSyncopeUser(wfResult.getResult());
  PropagationByResource localPropByRes=userDataBinder.fillVirtual(user,vAttrsToBeRemoved == null ? Collections.EMPTY_SET : vAttrsToBeRemoved,vAttrsToBeUpdated == null ? Collections.EMPTY_SET : vAttrsToBeUpdated,AttributableUtil.USER);
  if (wfResult.getPropByRes() != null && !wfResult.getPropByRes().isEmpty()) {
    localPropByRes.merge(wfResult.getPropByRes());
  }
 else {
    localPropByRes.addAll(PropagationOperation.UPDATE,user.getExternalResourceNames());
  }
  if (syncResourceName != null) {
    localPropByRes.get(PropagationOperation.CREATE).remove(syncResourceName);
    localPropByRes.get(PropagationOperation.UPDATE).remove(syncResourceName);
    localPropByRes.get(PropagationOperation.DELETE).remove(syncResourceName);
  }
  return provision(user,password,enable,localPropByRes);
}