subjects          = _getImmediateElements(privileges, "subject");
subjects          = this._getImmediateElements(privileges, "subject");
  private void _processNamingPrivLists()     throws  GrantPrivilegeException,            GroupModifyException,            InsufficientPrivilegeException,            RevokePrivilegeException,            SchemaException,            StemNotFoundException,            SubjectNotFoundException  {    if (namingPrivLists == null || namingPrivLists.size() == 0) {      return;    }    Collection  subjects;    Iterator    subjectsIterator;    Element     subjectE;    Element     privileges;    Map         map;    String      stem;    String      lastStem          = "";    Subject     subject           = null;    String      subjectType;    boolean     isImmediate       = false;    Group       privGroup;    Stem        focusStem         = null;    String      subjectId;    String      subjectIdentifier;    String      privilege;    Privilege   grouperPrivilege;    String      importOption;    for (int i = 0; i < namingPrivLists.size(); i++) {      map   = (Map) namingPrivLists.get(i);      stem  = (String) map.get("stem");      //Save a call if we are dealing with same group      if (!stem.equals(lastStem)) {        if (!XmlUtils.isEmpty(lastStem)) {          if (LOG.isInfoEnabled()) {            LOG.debug("Finished loading Naming privs for " + lastStem);          }        }        focusStem = StemFinder.findByName(s, stem);        if (LOG.isInfoEnabled()) {          LOG.debug("Loading Naming privs for " + stem);        }      }      lastStem = stem;      privileges    = (Element) map.get("privileges");      privilege     = privileges.getAttribute("type");      importOption  = privileges.getAttribute("importOption");      if (XmlUtils.isEmpty(importOption)) {        importOption = options.getProperty("import.data.privileges");      }      if (XmlUtils.isEmpty(importOption) || "ignore".equals(importOption)) {        if (LOG.isInfoEnabled()) {          LOG.debug("Ignoring any '" + privilege + "' privileges");        }        continue; //No instruction so ignore      }      grouperPrivilege = Privilege.getInstance(privilege);      if ("replace".equals(importOption)) {        if (LOG.isDebugEnabled()) {          LOG.debug("Revoking current '" + privilege + "' privileges");        }        focusStem.revokePriv(grouperPrivilege);      }      subjects          = _getImmediateElements(privileges, "subject");      subjectsIterator  = subjects.iterator();      while (subjectsIterator.hasNext()) {        subjectE    = (Element) subjectsIterator.next();        isImmediate = "true".equals(subjectE.getAttribute("immediate"));        if (XmlUtils.isEmpty(subjectE.getAttribute("immediate"))) {          isImmediate = true; //default is to assign        }        if (!isImmediate) {          continue;        }        subjectId         = subjectE.getAttribute("id");        subjectIdentifier = subjectE.getAttribute("identifier");        subjectType       = subjectE.getAttribute("type");        if ("group".equals(subjectType)) {          if (            subjectIdentifier.startsWith("*")            &&             !subjectIdentifier.endsWith("*")          )           {            //relative import            if (!XmlUtils.isEmpty(importRoot)) {              subjectIdentifier = importRoot + Stem.ROOT_INT + subjectIdentifier.substring(1);            }            else {              subjectIdentifier = subjectIdentifier.substring(1);            }          }           else {            subjectIdentifier = _getAbsoluteName(subjectIdentifier, stem);          }          try {            privGroup = GroupFinder.findByName(s, subjectIdentifier);          }           catch (Exception e) {            LOG.warn("Could not find Stem identified by " + subjectIdentifier);            continue;          }          subject = privGroup.toMember().getSubject();        }         else {          try {            if (XmlUtils.isEmpty(subjectId)) {              subject = _getSubjectByIdentifier(subjectIdentifier, subjectType);            }             else {              subject = SubjectFinder.findById(subjectId, subjectType);            }          }           catch (Exception e) {            String msg = "Could not find subject with ";            if (XmlUtils.isEmpty(subjectId)) {              msg = msg + "identifier=" + subjectIdentifier;            }            else {              msg = msg + "id=" + subjectId;            }            LOG.error(msg);            continue;          }        }        if (!XmlExporter.hasImmediatePrivilege(subject, focusStem, privilege)) {          if (LOG.isDebugEnabled()) {            LOG.debug("Assigning " + privilege + " to " + subject.getName() + " for " + stem);          }          focusStem.grantPriv(subject, Privilege.getInstance(privilege));          if (LOG.isDebugEnabled()) {            LOG.debug("...assigned");          }        }         else {          if (LOG.isDebugEnabled()) {            LOG.debug(privilege + " already assigned to " + subject.getName() + " so skipping");          }        }      }    }    if (LOG.isInfoEnabled()) {      LOG.debug("Finished assigning Naming privs");    }    namingPrivLists = null;  } // private void _processNamingPrivLists()