Program: 61314
Project: 61314
Buggy source:
public SyncopeUser createSyncopeUser(UserTO userTO) throws SyncopeClientCompositeErrorException, NotFoundException {
  SyncopeClientCompositeErrorException scce=new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
  SyncopeUser syncopeUser=null;
  if (userTO.getId() == 0) {
    syncopeUser=new SyncopeUser();
  }
 else {
    syncopeUser=syncopeUserDAO.find(userTO.getId());
    if (syncopeUser == null) {
      log.error("String_Node_Str" + userTO.getId() + "String_Node_Str");
      throw new NotFoundException(String.valueOf(userTO.getId()));
    }
  }
  SyncopeClientException invalidPassword=new SyncopeClientException(SyncopeClientExceptionType.InvalidPassword);
  if (userTO.getPassword() == null || userTO.getPassword().length() == 0) {
    log.error("String_Node_Str");
    invalidPassword.addElement("String_Node_Str");
  }
 else {
    syncopeUser.setPassword(userTO.getPassword());
  }
  if (!invalidPassword.getElements().isEmpty()) {
    scce.addException(invalidPassword);
  }
  syncopeUser=(SyncopeUser)fill(syncopeUser,userTO,AttributableUtil.USER,scce);
  SyncopeRole role=null;
  for (  MembershipTO membershipTO : userTO.getMemberships()) {
    role=syncopeRoleDAO.find(membershipTO.getRole());
    if (role == null) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + membershipTO.getRole());
      }
    }
 else {
      Membership membership=membershipDAO.find(syncopeUser,role);
      if (membership != null) {
        membershipDAO.delete(membership.getId());
      }
      membership=(Membership)fill(membership,membershipTO,AttributableUtil.MEMBERSHIP,scce);
      syncopeUser.addMembership(membership);
    }
  }
  return syncopeUser;
}

Fixed version (ground truth):
public SyncopeUser createSyncopeUser(UserTO userTO) throws SyncopeClientCompositeErrorException, NotFoundException {
  SyncopeClientCompositeErrorException scce=new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
  SyncopeUser syncopeUser=null;
  if (userTO.getId() == 0) {
    syncopeUser=new SyncopeUser();
  }
 else {
    syncopeUser=syncopeUserDAO.find(userTO.getId());
    if (syncopeUser == null) {
      log.error("String_Node_Str" + userTO.getId() + "String_Node_Str");
      throw new NotFoundException(String.valueOf(userTO.getId()));
    }
  }
  SyncopeClientException invalidPassword=new SyncopeClientException(SyncopeClientExceptionType.InvalidPassword);
  if (userTO.getPassword() == null || userTO.getPassword().length() == 0) {
    log.error("String_Node_Str");
    invalidPassword.addElement("String_Node_Str");
  }
 else {
    syncopeUser.setPassword(userTO.getPassword());
  }
  if (!invalidPassword.getElements().isEmpty()) {
    scce.addException(invalidPassword);
  }
  syncopeUser=(SyncopeUser)fill(syncopeUser,userTO,AttributableUtil.USER,scce);
  SyncopeRole role=null;
  for (  MembershipTO membershipTO : userTO.getMemberships()) {
    role=syncopeRoleDAO.find(membershipTO.getRole());
    if (role == null) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + membershipTO.getRole());
      }
    }
 else {
      Membership membership=new Membership();
      membership.setSyncopeRole(role);
      membership.setSyncopeUser(syncopeUser);
      membership=(Membership)fill(membership,membershipTO,AttributableUtil.MEMBERSHIP,scce);
      syncopeUser.addMembership(membership);
    }
  }
  return syncopeUser;
}