if (mpi.getContentType().match(Mime.CT_TEXT_HTML)) {
if (mpi.getContentType().equals(Mime.CT_TEXT_HTML)) {
    protected static void patchCalendarURLs(MimeMessage mm, String htmlStr, String localURL, String orgAddress, String uid, String attendee, String invId) throws ServiceException    {        try {            boolean changed = false;                        String accept = buildUrl(localURL, orgAddress, uid, attendee, invId, "ACCEPT");            String decline = buildUrl(localURL, orgAddress, uid, attendee, invId, "DECLINE");            String tentative = buildUrl(localURL, orgAddress, uid, attendee, invId, "TENTATIVE");                        List /*<MPartInfo>*/ parts = Mime.getParts(mm);            for (Iterator it = parts.iterator(); it.hasNext(); ) {                MPartInfo mpi = (MPartInfo) it.next();                                if (mpi.getContentType().match(Mime.CT_TEXT_HTML)) {                    String str = htmlStr;                                        str = str.replaceFirst("href=\"@@ACCEPT@@\"", accept);                    str = str.replaceFirst("href=\"@@DECLINE@@\"", decline);                    str = str.replaceFirst("href=\"@@TENTATIVE@@\"", tentative);                                        System.out.println(str);                    mpi.getMimePart().setContent(str, Mime.CT_TEXT_HTML);                    changed = true;                                        break; // only match one part                }            }                        if (changed) {                mm.saveChanges();            }        } catch (IOException e) {            throw ServiceException.FAILURE("IOException "+e, e);        } catch (MessagingException e) {            throw ServiceException.FAILURE("MessagingException "+e, e);        }    }