result.add(new LdapIdentity(sr.getNameInNamespace(), sr.getAttributes(), null));
result.add(new LdapIdentity(sr.getNameInNamespace(), sr.getAttributes()));
    private List<Identity> getIdentitiesByQuery(LdapAccount account, String query, DirContext initCtxt) throws ServiceException {        DirContext ctxt = initCtxt;        List<Identity> result = new ArrayList<Identity>();        try {            if (ctxt == null)                ctxt = LdapUtil.getDirContext();            String base = account.getDN();            NamingEnumeration ne = ctxt.search(base, query, sSubtreeSC);            while(ne.hasMore()) {                SearchResult sr = (SearchResult) ne.next();                result.add(new LdapIdentity(sr.getNameInNamespace(), sr.getAttributes(), null));            }            ne.close();                    } catch (NameNotFoundException e) {            return null;        } catch (InvalidNameException e) {            return null;                                } catch (NamingException e) {            throw ServiceException.FAILURE("unable to lookup identity via query: "+query+ " message: "+e.getMessage(), e);        } finally {            if (initCtxt == null)                LdapUtil.closeContext(ctxt);        }        return result;    }