pm.analyze(); try { pm.getRawData(); } catch (MessagingException me) { throw MailServiceException.MESSAGE_PARSE_ERROR(me); }  long start = ZimbraPerf.STOPWATCH_MBOX_ADD_MSG.start();               if (!noICal) { try { ZVCalendar cal = pm.getiCalendar(); if (cal != null) { ICalTok method = cal.getMethod(); if (ICalTok.REPLY.equals(method)) { processICalReplies(octxt, cal); noICal = true; } } } catch (Exception e) { ZimbraLog.calendar.warn("Error during calendar processing.  Continuing with message add", e); } }  Message msg = addMessageInternal(octxt, pm, folderId, noICal, flags, tagStr, conversationId, rcptEmail, null, sharedDeliveryCtxt); ZimbraPerf.STOPWATCH_MBOX_ADD_MSG.stop(start); return msg;
SharedDeliveryContext sharedDeliveryCtxt = new SharedDeliveryContext(); return addMessage(octxt, pm, folderId, noICal, flags, tags, conversationId, ":API:", sharedDeliveryCtxt);
    public Message addMessage(OperationContext octxt, ParsedMessage pm, int folderId,                boolean noICal, int flags, String tagStr, int conversationId,                String rcptEmail, SharedDeliveryContext sharedDeliveryCtxt)    throws IOException, ServiceException {        // make sure the message has been analyzed before taking the Mailbox lock        pm.analyze();        try {            pm.getRawData();        } catch (MessagingException me) {            throw MailServiceException.MESSAGE_PARSE_ERROR(me);        }        // and then actually add the message        long start = ZimbraPerf.STOPWATCH_MBOX_ADD_MSG.start();        // We process calendar replies here, where no transaction has yet        // been started on the current mailbox.  This is because some replies        // may require starting a transaction on another mailbox.  We thus avoid        // starting a nested transaction, which doesn't work.        //        // In addition, the current mailbox is not locked/synchronized at this        // point.  If we were synchronized and a reply processing enters a        // synchronized method on another mailbox, we're locking two mailboxes        // and that can easily lead to deadlocks.        //        // TODO: Generalize this technique for all calendar operations, not        // just REPLY's.        //        if (!noICal) {            try {                ZVCalendar cal = pm.getiCalendar();                if (cal != null) {                    ICalTok method = cal.getMethod();                    if (ICalTok.REPLY.equals(method)) {                        processICalReplies(octxt, cal);                        noICal = true;                    }                }            } catch (Exception e) {                ZimbraLog.calendar.warn("Error during calendar processing.  Continuing with message add", e);            }        }        Message msg = addMessageInternal(octxt, pm, folderId, noICal, flags, tagStr, conversationId,                    rcptEmail, null, sharedDeliveryCtxt);        ZimbraPerf.STOPWATCH_MBOX_ADD_MSG.stop(start);        return msg;    }