Program: 35344
Project: 35344
Buggy source:
/** 
 * Throw a functional exception if a conflict if found.
 * @param project Updated project.
 * @param values Values to update.
 * @param projectId
 * @throws FunctionalException
 */
private List<String> searchForConflicts(final Project project,final List<ValueEventWrapper> values,final UserExecutionContext context) throws FunctionalException {
  final ArrayList<String> conflicts=new ArrayList<>();
  if (project == null) {
    return conflicts;
  }
  Integer projectOrgUnitId=null;
  if (project.getOrgUnit() == null) {
    if (project.getProjectModel().getStatus() != ProjectModelStatus.DRAFT) {
      LOGGER.error("String_Node_Str",project.getId());
    }
 else     if (context.getUser().getMainOrgUnitWithProfiles() == null) {
      LOGGER.error("String_Node_Str",context.getUser().getId());
    }
 else {
      projectOrgUnitId=context.getUser().getMainOrgUnitWithProfiles().getOrgUnit().getId();
    }
  }
 else {
    projectOrgUnitId=project.getOrgUnit().getId();
  }
  final Language language=context.getLanguage();
  ProfileDTO profile=null;
  if (projectOrgUnitId != null) {
    profile=Handlers.aggregateProfiles(context.getUser(),mapper).get(projectOrgUnitId);
  }
  if (project.getProjectModel().isUnderMaintenance()) {
    conflicts.add(i18nServer.t(language,"String_Node_Str",project.getName(),project.getFullName()));
    return conflicts;
  }
  conflictsRelatedToComputedElements(values,project,conflicts,language);
  if (ProfileUtils.isGranted(profile,GlobalPermissionEnum.MODIFY_LOCKED_CONTENT)) {
    final boolean projectIsClosed=project.getCloseDate() != null;
    final boolean projectIsLocked=project.getAmendmentState() == AmendmentState.LOCKED;
    for (    final ValueEventWrapper value : values) {
      final FlexibleElementDTO source=value.getSourceElement();
      final boolean phaseIsClosed=conflictHandler.isParentPhaseClosed(source.getId(),project.getId());
      if (projectIsClosed || phaseIsClosed || (source.getAmendable() && projectIsLocked)) {
        final ValueResult result=new ValueResult();
        result.setValueObject(value.getSingleValue());
        result.setValuesObject(value.getTripletValue() != null ? Collections.<ListableValue>singletonList(value.getTripletValue()) : null);
        if (!source.isCorrectRequiredValue(result)) {
          conflicts.add(i18nServer.t(language,"String_Node_Str",source.getFormattedLabel(),valueService.getCurrentValueFormatted(project.getId(),source)));
        }
      }
    }
    return conflicts;
  }
  if (project.getCloseDate() != null) {
    for (    final ValueEventWrapper valueEvent : values) {
      final FlexibleElementDTO source=valueEvent.getSourceElement();
      conflicts.add(i18nServer.t(language,"String_Node_Str",source.getFormattedLabel(),valueService.getCurrentValueFormatted(project.getId(),source),getTargetValueFormatted(valueEvent)));
    }
  }
 else {
    Iterator<ValueEventWrapper> iterator=values.iterator();
    while (iterator.hasNext()) {
      final ValueEventWrapper valueEvent=iterator.next();
      final FlexibleElementDTO source=valueEvent.getSourceElement();
      if (conflictHandler.isParentPhaseClosed(source.getId(),project.getId())) {
        iterator.remove();
        conflicts.add(i18nServer.t(language,"String_Node_Str",source.getFormattedLabel(),valueService.getCurrentValueFormatted(project.getId(),source),getTargetValueFormatted(valueEvent)));
      }
    }
    if (project.getAmendmentState() == AmendmentState.LOCKED) {
      iterator=values.iterator();
      while (iterator.hasNext()) {
        final ValueEventWrapper valueEvent=iterator.next();
        final FlexibleElementDTO source=valueEvent.getSourceElement();
        final boolean conflict;
        if (source.getAmendable()) {
          if (source instanceof BudgetElementDTO) {
            final BudgetSubFieldDTO divisorField=((BudgetElementDTO)source).getRatioDivisor();
            final Value value=valueService.retrieveCurrentValue(project.getId(),source.getId(),valueEvent.getIterationId());
            conflict=getValueOfSubField(value.getValue(),divisorField) != getValueOfSubField(valueEvent.getSingleValue(),divisorField);
          }
 else {
            conflict=true;
          }
        }
 else {
          conflict=false;
        }
        if (conflict) {
          iterator.remove();
          conflicts.add(i18nServer.t(language,"String_Node_Str",source.getFormattedLabel(),valueService.getCurrentValueFormatted(project.getId(),source),getTargetValueFormatted(valueEvent)));
        }
      }
    }
  }
  return conflicts;
}

Fixed version (ground truth):
/** 
 * Throw a functional exception if a conflict if found.
 * @param project Updated project.
 * @param values Values to update.
 * @param projectId
 * @throws FunctionalException
 */
private List<String> searchForConflicts(final Project project,final List<ValueEventWrapper> values,final UserExecutionContext context) throws FunctionalException {
  final ArrayList<String> conflicts=new ArrayList<>();
  if (project == null) {
    return conflicts;
  }
  Integer projectOrgUnitId=null;
  if (project.getOrgUnit() == null) {
    if (project.getProjectModel().getStatus() != ProjectModelStatus.DRAFT) {
      LOGGER.error("String_Node_Str",project.getId());
    }
 else     if (context.getUser().getMainOrgUnitWithProfiles() == null) {
      LOGGER.error("String_Node_Str",context.getUser().getId());
    }
 else {
      projectOrgUnitId=context.getUser().getMainOrgUnitWithProfiles().getOrgUnit().getId();
    }
  }
 else {
    projectOrgUnitId=project.getOrgUnit().getId();
  }
  final Language language=context.getLanguage();
  ProfileDTO profile=null;
  if (projectOrgUnitId != null) {
    profile=Handlers.aggregateProfiles(context.getUser(),mapper).get(projectOrgUnitId);
  }
  if (project.getProjectModel().isUnderMaintenance()) {
    conflicts.add(i18nServer.t(language,"String_Node_Str",project.getName(),project.getFullName()));
    return conflicts;
  }
  conflictsRelatedToComputedElements(values,project,conflicts,language);
  if (ProfileUtils.isGranted(profile,GlobalPermissionEnum.MODIFY_LOCKED_CONTENT)) {
    final boolean projectIsClosed=project.getCloseDate() != null;
    final boolean projectIsLocked=project.getAmendmentState() == AmendmentState.LOCKED;
    for (    final ValueEventWrapper value : values) {
      final FlexibleElementDTO source=value.getSourceElement();
      final boolean phaseIsClosed=conflictHandler.isParentPhaseClosed(source.getId(),project.getId());
      if (projectIsClosed || phaseIsClosed || (source.getAmendable() && projectIsLocked)) {
        final ValueResult result=new ValueResult();
        final String updateSingleValue=value.getSingleValue();
        final TripletValueDTO updateListValue=value.getTripletValue();
        final Set<Integer> multivaluedIdsValue=value.getMultivaluedIdsValue();
        if (updateSingleValue != null) {
          result.setValueObject(updateSingleValue);
        }
 else         if (updateListValue != null) {
          result.setValuesObject(Collections.<ListableValue>singletonList(value.getTripletValue()));
        }
 else         if (multivaluedIdsValue != null) {
          result.setValueObject(ValueResultUtils.mergeElements(new ArrayList<Integer>(multivaluedIdsValue)));
        }
 else {
          LOGGER.warn("String_Node_Str",source.getId(),source.getEntityName(),project.getId());
        }
        if (!source.isCorrectRequiredValue(result)) {
          conflicts.add(i18nServer.t(language,"String_Node_Str",source.getFormattedLabel(),valueService.getCurrentValueFormatted(project.getId(),source)));
        }
      }
    }
    return conflicts;
  }
  if (project.getCloseDate() != null) {
    for (    final ValueEventWrapper valueEvent : values) {
      final FlexibleElementDTO source=valueEvent.getSourceElement();
      conflicts.add(i18nServer.t(language,"String_Node_Str",source.getFormattedLabel(),valueService.getCurrentValueFormatted(project.getId(),source),getTargetValueFormatted(valueEvent)));
    }
  }
 else {
    Iterator<ValueEventWrapper> iterator=values.iterator();
    while (iterator.hasNext()) {
      final ValueEventWrapper valueEvent=iterator.next();
      final FlexibleElementDTO source=valueEvent.getSourceElement();
      if (conflictHandler.isParentPhaseClosed(source.getId(),project.getId())) {
        iterator.remove();
        conflicts.add(i18nServer.t(language,"String_Node_Str",source.getFormattedLabel(),valueService.getCurrentValueFormatted(project.getId(),source),getTargetValueFormatted(valueEvent)));
      }
    }
    if (project.getAmendmentState() == AmendmentState.LOCKED) {
      iterator=values.iterator();
      while (iterator.hasNext()) {
        final ValueEventWrapper valueEvent=iterator.next();
        final FlexibleElementDTO source=valueEvent.getSourceElement();
        final boolean conflict;
        if (source.getAmendable()) {
          if (source instanceof BudgetElementDTO) {
            final BudgetSubFieldDTO divisorField=((BudgetElementDTO)source).getRatioDivisor();
            final Value value=valueService.retrieveCurrentValue(project.getId(),source.getId(),valueEvent.getIterationId());
            conflict=getValueOfSubField(value.getValue(),divisorField) != getValueOfSubField(valueEvent.getSingleValue(),divisorField);
          }
 else {
            conflict=true;
          }
        }
 else {
          conflict=false;
        }
        if (conflict) {
          iterator.remove();
          conflicts.add(i18nServer.t(language,"String_Node_Str",source.getFormattedLabel(),valueService.getCurrentValueFormatted(project.getId(),source),getTargetValueFormatted(valueEvent)));
        }
      }
    }
  }
  return conflicts;
}