if (ldapAccount == null)
if (ldapEntry == null)
    public Identity createIdentity(Account account, String identityName, Map<String, Object> identityAttrs) throws ServiceException {                LdapAccount ldapAccount = (LdapAccount) (account instanceof LdapAccount ? account : getAccountById(account.getId()));                if (ldapAccount == null)             throw AccountServiceException.NO_SUCH_ACCOUNT(account.getName());                if (identityName.equalsIgnoreCase(DEFAULT_IDENTITY_NAME))                throw AccountServiceException.IDENTITY_EXISTS(identityName);                List<Identity> existing = getAllIdentities(ldapAccount);        if (existing.size() >= ldapAccount.getLongAttr(A_zimbraIdentityMaxNumEntries, 20))            throw AccountServiceException.TOO_MANY_IDENTITIES();                        HashMap attrManagerContext = new HashMap();        AttributeManager.getInstance().preModify(identityAttrs, null, attrManagerContext, true, true);        DirContext ctxt = null;        try {            ctxt = LdapUtil.getDirContext(true);            String dn = getIdentityDn(ldapAccount, identityName);                        Attributes attrs = new BasicAttributes(true);            LdapUtil.mapToAttrs(identityAttrs, attrs);            Attribute oc = LdapUtil.addAttr(attrs, A_objectClass, "zimbraIdentity");            createSubcontext(ctxt, dn, attrs, "createIdentity");            Identity identity = getIdentityByName(ldapAccount, identityName, ctxt);            AttributeManager.getInstance().postModify(identityAttrs, identity, attrManagerContext, true);            return identity;        } catch (NameAlreadyBoundException nabe) {            throw AccountServiceException.IDENTITY_EXISTS(identityName);        } finally {            LdapUtil.closeContext(ctxt);        }    }