Program: 35603
Project: 35603
Buggy source:
@Override public Object create(User executingUser,PropertyMap properties){
  User userToPersist=null;
  User userFound=null;
  OrgUnitProfile orgUnitProfileToPersist=null;
  OrgUnitProfile orgUnitProfileFound=null;
  int id=(Integer)properties.get("String_Node_Str");
  String email=properties.get("String_Node_Str");
  String name=properties.get("String_Node_Str");
  String firstName=properties.get("String_Node_Str");
  String locale=properties.get("String_Node_Str");
  String password=properties.get("String_Node_Str");
  int orgUnitId=(Integer)properties.get("String_Node_Str");
  List<Integer> profilesIds=properties.get("String_Node_Str");
  if (email != null && name != null) {
    userFound=em.find(User.class,id);
    if (userFound != null) {
      if (userUnitDAO.doesOrgUnitProfileExist(userFound))       orgUnitProfileFound=userUnitDAO.findOrgUnitProfileByUser(userFound);
    }
    userToPersist=UserDAOImpl.createNewUser(email,name,locale);
    userToPersist.setFirstName(firstName);
    userToPersist.setOrganization(executingUser.getOrganization());
    if (password != null && !password.isEmpty()) {
      userToPersist.setHashedPassword(PasswordHelper.hashPassword(password));
      userToPersist.setChangePasswordKey(null);
      userToPersist.setDateChangePasswordKeyIssued(new Date());
    }
    if (userFound != null && userFound.getId() > 0) {
      userToPersist.setId(userFound.getId());
      userToPersist=em.merge(userToPersist);
    }
 else {
      if (!userDAO.doesUserExist(email)) {
        userDAO.persist(userToPersist);
        try {
          final StringBuilder sb=new StringBuilder();
          sb.append(this.properties.getProperty(KEY_HOST_URL,DEFAULT_HOST_URL));
          sb.append("String_Node_Str");
          sb.append(userToPersist.getChangePasswordKey());
          final String confirmUrl=sb.toString();
          if (log.isDebugEnabled()) {
            log.debug("String_Node_Str" + userToPersist.getEmail());
            log.debug("String_Node_Str" + confirmUrl);
          }
          final Locale userLocale=new Locale(locale);
          inviteMailer.send(new Invitation(userToPersist,executingUser,confirmUrl),userLocale,true);
        }
 catch (        Exception e) {
          log.debug("String_Node_Str");
          log.debug(e.getMessage());
          System.out.println(e.getStackTrace());
        }
      }
 else {
        return null;
      }
    }
    if (userToPersist.getId() > 0) {
      if (userFound != null && userFound.getId() > 0 && orgUnitProfileFound != null)       orgUnitProfileToPersist=orgUnitProfileFound;
 else       orgUnitProfileToPersist=new OrgUnitProfile();
      OrgUnit orgUnit=em.find(OrgUnit.class,orgUnitId);
      if (orgUnit != null) {
        orgUnitProfileToPersist.setOrgUnit(orgUnit);
        List<Profile> profilesToPersist=new ArrayList<Profile>();
        for (        int profileId : profilesIds) {
          Profile profile=em.find(Profile.class,profileId);
          profilesToPersist.add(profile);
        }
        orgUnitProfileToPersist.setProfiles(profilesToPersist);
        orgUnitProfileToPersist.setUser(userToPersist);
        if (userFound != null && userFound.getId() > 0 && orgUnitProfileFound != null) {
          orgUnitProfileToPersist=em.merge(orgUnitProfileToPersist);
        }
 else {
          em.persist(orgUnitProfileToPersist);
        }
        if (orgUnitProfileToPersist.getId() != 0) {
          userToPersist.setOrgUnitWithProfiles(orgUnitProfileToPersist);
        }
      }
    }
  }
  UserDTO userPersisted=null;
  if (userToPersist != null) {
    userPersisted=GetUsersWithProfilesHandler.mapUserToUserDTO(userToPersist,mapper);
    userPersisted.setIdd(userToPersist.getId());
  }
  return userPersisted;
}

Fixed version (ground truth):
@Override public Object create(User executingUser,PropertyMap properties){
  User userToPersist=null;
  User userFound=null;
  OrgUnitProfile orgUnitProfileToPersist=null;
  OrgUnitProfile orgUnitProfileFound=null;
  int id=(Integer)properties.get("String_Node_Str");
  String email=properties.get("String_Node_Str");
  String name=properties.get("String_Node_Str");
  String firstName=properties.get("String_Node_Str");
  String locale=properties.get("String_Node_Str");
  String password=properties.get("String_Node_Str");
  int orgUnitId=(Integer)properties.get("String_Node_Str");
  List<Integer> profilesIds=properties.get("String_Node_Str");
  if (email != null && name != null) {
    userFound=em.find(User.class,id);
    if (userFound != null) {
      if (userUnitDAO.doesOrgUnitProfileExist(userFound))       orgUnitProfileFound=userUnitDAO.findOrgUnitProfileByUser(userFound);
    }
    userToPersist=UserDAOImpl.createNewUser(email,name,locale);
    userToPersist.setFirstName(firstName);
    userToPersist.setOrganization(executingUser.getOrganization());
    if (password != null && !password.isEmpty()) {
      userToPersist.setHashedPassword(PasswordHelper.hashPassword(password));
      userToPersist.setChangePasswordKey(null);
      userToPersist.setDateChangePasswordKeyIssued(new Date());
    }
    if (userFound != null && userFound.getId() > 0) {
      userToPersist.setId(userFound.getId());
      userToPersist=em.merge(userToPersist);
    }
 else {
      if (!userDAO.doesUserExist(email)) {
        password=PasswordHelper.generatePassword();
        userToPersist.setHashedPassword(PasswordHelper.hashPassword(password));
        userDAO.persist(userToPersist);
        try {
          final String confirmUrl=this.properties.getProperty(KEY_HOST_URL,DEFAULT_HOST_URL);
          final Locale userLocale=new Locale(locale);
          inviteMailer.send(new Invitation(userToPersist,executingUser,confirmUrl,password),userLocale,true);
        }
 catch (        Exception e) {
          log.debug("String_Node_Str");
          log.debug(e.getMessage());
          System.out.println(e.getStackTrace());
        }
      }
 else {
        return null;
      }
    }
    if (userToPersist.getId() > 0) {
      if (userFound != null && userFound.getId() > 0 && orgUnitProfileFound != null)       orgUnitProfileToPersist=orgUnitProfileFound;
 else       orgUnitProfileToPersist=new OrgUnitProfile();
      OrgUnit orgUnit=em.find(OrgUnit.class,orgUnitId);
      if (orgUnit != null) {
        orgUnitProfileToPersist.setOrgUnit(orgUnit);
        List<Profile> profilesToPersist=new ArrayList<Profile>();
        for (        int profileId : profilesIds) {
          Profile profile=em.find(Profile.class,profileId);
          profilesToPersist.add(profile);
        }
        orgUnitProfileToPersist.setProfiles(profilesToPersist);
        orgUnitProfileToPersist.setUser(userToPersist);
        if (userFound != null && userFound.getId() > 0 && orgUnitProfileFound != null) {
          orgUnitProfileToPersist=em.merge(orgUnitProfileToPersist);
        }
 else {
          em.persist(orgUnitProfileToPersist);
        }
        if (orgUnitProfileToPersist.getId() != 0) {
          userToPersist.setOrgUnitWithProfiles(orgUnitProfileToPersist);
        }
      }
    }
  }
  UserDTO userPersisted=null;
  if (userToPersist != null) {
    userPersisted=GetUsersWithProfilesHandler.mapUserToUserDTO(userToPersist,mapper);
    userPersisted.setIdd(userToPersist.getId());
  }
  return userPersisted;
}