HashMap attrs = new HashMap();
Map<String, Object> attrs = new HashMap<String, Object>();
    public void renameDistributionList(String zimbraId, String newEmail) throws ServiceException {        DirContext ctxt = null;        try {            ctxt = LdapUtil.getDirContext(true);                        LdapDistributionList dl = (LdapDistributionList) getDistributionListById(zimbraId, ctxt);            if (dl == null)                throw AccountServiceException.NO_SUCH_DISTRIBUTION_LIST(zimbraId);            String oldEmail = dl.getName();            newEmail = newEmail.toLowerCase().trim();            String[] parts = EmailUtil.getLocalPartAndDomain(newEmail);            if (parts == null)                throw ServiceException.INVALID_REQUEST("bad value for newName", null);            String newLocal = parts[0];            String newDomain = parts[1];            Domain domain = getDomainByName(newDomain, ctxt);            if (domain == null)                throw AccountServiceException.NO_SUCH_DOMAIN(newDomain);                String newDn = emailToDN(newLocal, domain.getName());            ctxt.rename(dl.mDn, newDn);                        renameAddressInAllDistributionLists(oldEmail, newEmail); // doesn't throw exceptions, just logs                        dl = (LdapDistributionList) getDistributionListById(zimbraId,ctxt);            HashMap attrs = new HashMap();            String mail[] = dl.getMultiAttr(Provisioning.A_mail);            if (mail.length == 0) {                attrs.put(Provisioning.A_mail, newEmail);            } else {                // not the most efficient, but renames don't happen often                mail = LdapUtil.removeMultiValue(mail, oldEmail);                mail = addMultiValue(mail, newEmail);                attrs.put(Provisioning.A_mail, mail);            }            String aliases[] = dl.getMultiAttr(Provisioning.A_zimbraMailAlias);            if (aliases.length == 0) {                attrs.put(Provisioning.A_zimbraMailAlias, newEmail);            } else {                // not the most efficient, but renames don't happen often                aliases = LdapUtil.removeMultiValue(aliases, oldEmail);                aliases = addMultiValue(aliases, newEmail);                attrs.put(Provisioning.A_zimbraMailAlias, aliases);            }                        // this is non-atomic. i.e., rename could succeed and updating A_mail            // could fail. So catch service exception here and log error                        try {                dl.modifyAttrsInternal(ctxt, attrs);            } catch (ServiceException e) {                ZimbraLog.account.error("distribution list renamed to " + newLocal +                        " but failed to move old name's LDAP attributes", e);                throw ServiceException.FAILURE("unable to rename distribution list: "+zimbraId, e);            }        } catch (NameAlreadyBoundException nabe) {            throw AccountServiceException.DISTRIBUTION_LIST_EXISTS(newEmail);                    } catch (NamingException e) {            throw ServiceException.FAILURE("unable to rename distribution list: " + zimbraId, e);        } finally {            LdapUtil.closeContext(ctxt);        }    }