use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class ImapHandler method doSTORE.
private boolean doSTORE(String tag, String sequenceSet, List<String> flagNames, StoreAction operation, boolean silent, int modseq, boolean byUID) throws IOException, ImapException {
checkCommandThrottle(new StoreCommand(sequenceSet, flagNames, operation, modseq));
if (!checkState(tag, State.SELECTED)) {
return true;
}
ImapFolder i4folder = getSelectedFolder();
if (i4folder == null) {
throw new ImapSessionClosedException();
}
if (!i4folder.isWritable()) {
sendNO(tag, "mailbox selected READ-ONLY");
return true;
}
if (modseq >= 0) {
activateExtension(ImapExtension.CONDSTORE);
}
boolean modseqEnabled = sessionActivated(ImapExtension.CONDSTORE);
// MUST reject any such command with the tagged BAD response."
if (!modseqEnabled && modseq >= 0) {
throw new ImapParseException(tag, "NOMODSEQ", "cannot STORE UNCHANGEDSINCE in this mailbox", true);
}
ImapMessageSet modifyConflicts = modseqEnabled ? new ImapMessageSet() : null;
String command = (byUID ? "UID STORE" : "STORE");
List<Tag> newTags = (operation != StoreAction.REMOVE ? new ArrayList<Tag>() : null);
MailboxStore mbox = selectedFolderListener.getMailbox();
Set<ImapMessage> i4set;
mbox.lock(true);
try {
i4set = i4folder.getSubsequence(tag, sequenceSet, byUID);
} finally {
mbox.unlock();
}
boolean allPresent = byUID || !i4set.contains(null);
i4set.remove(null);
try {
// list of tag names (not including Flags)
List<String> tags = Lists.newArrayList();
// just Flag objects, no need to convert Tag objects to ImapFlag here
Set<ImapFlag> i4flags = new HashSet<ImapFlag>(flagNames.size());
for (String name : flagNames) {
ImapFlag i4flag = i4folder.getFlagByName(name);
if (i4flag == null) {
tags.add(name);
// new tag for this folder
continue;
} else if (i4flag.mId > 0) {
tags.add(i4flag.mName);
} else {
i4flags.add(i4flag);
}
if (operation != StoreAction.REMOVE) {
if (i4flag.mId == Flag.ID_DELETED) {
if (!i4folder.getPath().isWritable(ACL.RIGHT_DELETE)) {
throw ServiceException.PERM_DENIED("you do not have permission to set the \\Deleted flag");
}
} else if (i4flag.mPermanent && (!i4folder.getPath().isWritable(ACL.RIGHT_WRITE))) {
throw ServiceException.PERM_DENIED("you do not have permission to set the " + i4flag.mName + " flag");
}
}
}
// if we're doing a STORE FLAGS (i.e. replace), precompute the new set of flags for all the affected messages
int flags = Flag.BITMASK_UNREAD;
short sflags = 0;
if (operation == StoreAction.REPLACE) {
for (ImapFlag i4flag : i4flags) {
if (!i4flag.mPermanent) {
sflags = (byte) (i4flag.mPositive ? sflags | i4flag.mBitmask : sflags & ~i4flag.mBitmask);
} else {
flags = (int) (i4flag.mPositive ? flags | i4flag.mBitmask : flags & ~i4flag.mBitmask);
}
}
}
long checkpoint = System.currentTimeMillis();
int i = 0;
List<ImapMessage> i4list = new ArrayList<ImapMessage>(SUGGESTED_BATCH_SIZE);
List<Integer> idlist = new ArrayList<Integer>(SUGGESTED_BATCH_SIZE);
for (ImapMessage msg : i4set) {
// we're sending 'em off in batches of 100
i4list.add(msg);
idlist.add(msg.msgId);
if (++i % SUGGESTED_BATCH_SIZE != 0 && i != i4set.size()) {
continue;
}
mbox.lock(true);
try {
String folderOwner = i4folder.getFolder().getFolderItemIdentifier().accountId;
List<ItemIdentifier> itemIds = ItemIdentifier.fromAccountIdAndItemIds((folderOwner != null) ? folderOwner : mbox.getAccountId(), idlist);
if (modseq >= 0) {
List<ZimbraMailItem> items = mbox.getItemsById(getContext(), itemIds);
for (int idx = items.size() - 1; idx >= 0; idx--) {
ImapMessage i4msg = i4list.get(idx);
if (items.get(idx).getModifiedSequence() > modseq) {
modifyConflicts.add(i4msg);
i4list.remove(idx);
idlist.remove(idx);
allPresent = false;
}
}
}
try {
// if it was a STORE [+-]?FLAGS.SILENT, temporarily disable notifications
if (silent && !modseqEnabled) {
i4folder.disableNotifications();
}
if (operation == StoreAction.REPLACE) {
// replace real tags and flags on all messages
mbox.setTags(getContext(), itemIds, flags, tags);
// replace session tags on all messages
for (ImapMessage i4msg : i4list) {
i4msg.setSessionFlags(sflags, i4folder);
}
} else {
for (ImapFlag i4flag : i4flags) {
boolean add = operation == StoreAction.ADD ^ !i4flag.mPositive;
if (i4flag.mPermanent) {
// real Flag (not a Tag); do a batch update to the DB
if ((i4flag.mBitmask & Flag.BITMASK_DELETED) > 0) {
ZimbraLog.imap.info("IMAP client has flagged the item with id %d to be Deleted altertag", msg.msgId);
}
mbox.alterTag(getContext(), itemIds, i4flag.mName, add);
} else {
// session tag; update one-by-one in memory only
for (ImapMessage i4msg : i4list) {
i4msg.setSessionFlags((short) (add ? i4msg.sflags | i4flag.mBitmask : i4msg.sflags & ~i4flag.mBitmask), i4folder);
}
}
}
boolean add = operation == StoreAction.ADD;
// add (or remove) Tags
for (String tagName : tags) {
mbox.alterTag(getContext(), itemIds, tagName, add);
}
}
} finally {
// if it was a STORE [+-]?FLAGS.SILENT, reenable notifications
i4folder.enableNotifications();
}
} finally {
mbox.unlock();
}
if (!silent || modseqEnabled) {
for (ImapMessage i4msg : i4list) {
ImapFolder.DirtyMessage dirty = i4folder.undirtyMessage(i4msg);
if (silent && (dirty == null || dirty.modseq <= 0)) {
continue;
}
StringBuilder ntfn = new StringBuilder();
boolean empty = true;
ntfn.append(i4msg.sequence).append(" FETCH (");
if (!silent) {
ntfn.append(i4msg.getFlags(i4folder));
empty = false;
}
// caused by a UID command..."
if (byUID) {
ntfn.append(empty ? "" : " ").append("UID ").append(i4msg.imapUid);
empty = false;
}
if (dirty != null && dirty.modseq > 0 && modseqEnabled) {
ntfn.append(empty ? "" : " ").append("MODSEQ (").append(dirty.modseq).append(')');
empty = false;
}
sendUntagged(ntfn.append(')').toString());
}
} else {
// send a gratuitous untagged response to keep pissy clients from closing the socket from inactivity
long now = System.currentTimeMillis();
if (now - checkpoint > MAXIMUM_IDLE_PROCESSING_MILLIS) {
sendIdleUntagged();
checkpoint = now;
}
}
i4list.clear();
idlist.clear();
}
} catch (ServiceException e) {
deleteTags(newTags);
if (e.getCode().equals(MailServiceException.INVALID_NAME)) {
ZimbraLog.imap.info("%s failed: %s", command, e.getMessage());
} else {
ZimbraLog.imap.warn("%s failed", command, e);
}
sendNO(tag, command + " failed");
return canContinue(e);
}
boolean hadConflicts = modifyConflicts != null && !modifyConflicts.isEmpty();
String conflicts = hadConflicts ? " [MODIFIED " + ImapFolder.encodeSubsequence(modifyConflicts, byUID) + ']' : "";
sendNotifications(byUID, false);
// a FETCH response for the non-expunged messages along with a tagged NO."
if (silent || allPresent) {
sendOK(tag, command + conflicts + " completed");
} else {
sendNO(tag, command + conflicts + " completed");
}
return true;
}
use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class ImapHandler method fetch.
private boolean fetch(String tag, String sequenceSet, int attributes, List<ImapPartSpecifier> parts, boolean byUID, int changedSince, boolean standalone, boolean allowOutOfRangeMsgSeq) throws IOException, ImapException {
if (!checkState(tag, State.SELECTED)) {
return true;
}
ImapFolder i4folder = getSelectedFolder();
if (i4folder == null) {
throw new ImapSessionClosedException();
}
// of whether a UID was specified as a message data item to the FETCH."
if (byUID) {
attributes |= FETCH_UID;
}
String command = (byUID ? "UID FETCH" : "FETCH");
boolean markRead = i4folder.isWritable() && (attributes & FETCH_MARK_READ) != 0;
// the CHANGEDSINCE UID FETCH modifier."
if ((attributes & FETCH_VANISHED) != 0 && (!byUID || changedSince < 0)) {
throw new ImapParseException(tag, "cannot specify VANISHED without CHANGEDSINCE");
}
if (changedSince >= 0) {
attributes |= FETCH_MODSEQ;
}
if ((attributes & FETCH_MODSEQ) != 0) {
activateExtension(ImapExtension.CONDSTORE);
}
boolean modseqEnabled = sessionActivated(ImapExtension.CONDSTORE);
// MUST reject any such command with the tagged BAD response."
if (!modseqEnabled && (attributes & FETCH_MODSEQ) != 0) {
throw new ImapParseException(tag, "NOMODSEQ", "cannot FETCH MODSEQ in this mailbox", true);
}
List<ImapPartSpecifier> fullMessage = new ArrayList<ImapPartSpecifier>();
if (parts != null && !parts.isEmpty()) {
for (Iterator<ImapPartSpecifier> it = parts.iterator(); it.hasNext(); ) {
ImapPartSpecifier pspec = it.next();
if (pspec.isEntireMessage()) {
it.remove();
fullMessage.add(pspec);
}
}
}
ImapMessageSet i4set;
MailboxStore mbox = i4folder.getMailbox();
mbox.lock(false);
try {
i4set = i4folder.getSubsequence(tag, sequenceSet, byUID, allowOutOfRangeMsgSeq, true);
i4set.remove(null);
} finally {
mbox.unlock();
}
// if VANISHED was requested, we need to return the set of UIDs that *don't* exist in the folder
if (byUID && (attributes & FETCH_VANISHED) != 0) {
int highwater = Integer.MAX_VALUE;
try {
highwater = i4folder.getCurrentMODSEQ();
} catch (ServiceException e) {
}
if (highwater > changedSince) {
String vanished = i4folder.invertSubsequence(sequenceSet, true, i4set);
if (!vanished.isEmpty()) {
sendUntagged("VANISHED (EARLIER) " + vanished);
}
}
}
// make sure it's not just a set of nothing but expunged messages
if (!byUID && !i4set.isEmpty()) {
boolean nonePresent = true;
for (ImapMessage i4msg : i4set) {
if (!i4msg.isExpunged()) {
nonePresent = false;
break;
}
}
if (nonePresent) {
// expunged, the server SHOULD return only a tagged NO."
if (standalone) {
sendNO(tag, "all of the requested messages have been expunged");
}
return true;
}
}
// if a CHANGEDSINCE sequence number was specified, narrow the message set before iterating over the messages
if (changedSince >= 0) {
try {
// get a list of all the messages modified since the checkpoint
ImapMessageSet modified = new ImapMessageSet();
for (int id : mbox.getIdsOfModifiedItemsInFolder(getContext(), changedSince, i4folder.getId())) {
ImapMessage i4msg = i4folder.getById(id);
if (i4msg != null) {
modified.add(i4msg);
}
}
// and intersect those "modified" messages with the set of requested messages
i4set.retainAll(modified);
} catch (ServiceException e) {
if (standalone) {
ZimbraLog.imap.warn(command + " failed", e);
sendNO(tag, command + " failed");
return canContinue(e);
}
}
}
mbox.lock(true);
try {
if (i4folder.areTagsDirty()) {
sendUntagged("FLAGS (" + StringUtil.join(" ", i4folder.getFlagList(false)) + ')');
i4folder.setTagsDirty(false);
}
} finally {
mbox.unlock();
}
ReentrantLock lock = null;
try {
for (ImapMessage i4msg : i4set) {
PrintStream result = new PrintStream(output, false, Charsets.UTF_8.name());
try {
result.print("* " + i4msg.sequence + " FETCH (");
if (i4msg.isExpunged()) {
fetchStub(i4msg, i4folder, attributes, parts, fullMessage, result);
continue;
}
boolean markMessage = markRead && (i4msg.flags & Flag.BITMASK_UNREAD) != 0;
boolean empty = true;
ZimbraMailItem item = null;
MimeMessage mm;
if (!fullMessage.isEmpty() || (parts != null && !parts.isEmpty()) || (attributes & ~FETCH_FROM_CACHE) != 0) {
if (lock == null && LC.imap_throttle_fetch.booleanValue()) {
lock = commandThrottle.lock(credentials.getAccountId());
}
try {
String folderOwner = i4folder.getFolder().getFolderItemIdentifier().accountId;
ItemIdentifier iid = ItemIdentifier.fromAccountIdAndItemId((folderOwner != null) ? folderOwner : mbox.getAccountId(), i4msg.msgId);
item = mbox.getItemById(getContext(), iid, i4msg.getType().toCommon());
} catch (NoSuchItemException nsie) {
// just in case we're out of sync, force this message back into sync
i4folder.markMessageExpunged(i4msg);
fetchStub(i4msg, i4folder, attributes, parts, fullMessage, result);
continue;
}
}
if ((attributes & FETCH_UID) != 0) {
result.print((empty ? "" : " ") + "UID " + i4msg.imapUid);
empty = false;
}
if ((attributes & FETCH_INTERNALDATE) != 0) {
result.print((empty ? "" : " ") + "INTERNALDATE \"" + DateUtil.toImapDateTime(new Date(item.getDate())) + '"');
empty = false;
}
if ((attributes & FETCH_RFC822_SIZE) != 0) {
result.print((empty ? "" : " ") + "RFC822.SIZE " + i4msg.getSize(item));
empty = false;
}
if ((attributes & FETCH_BINARY_SIZE) != 0) {
result.print((empty ? "" : " ") + "BINARY.SIZE[] " + i4msg.getSize(item));
empty = false;
}
if (!fullMessage.isEmpty()) {
for (ImapPartSpecifier pspec : fullMessage) {
result.print(empty ? "" : " ");
pspec.write(result, output, item);
empty = false;
}
}
if ((parts != null && !parts.isEmpty()) || (attributes & FETCH_FROM_MIME) != 0) {
mm = ImapMessage.getMimeMessage(item);
if ((attributes & FETCH_BODY) != 0) {
result.print(empty ? "" : " ");
result.print("BODY ");
ImapMessage.serializeStructure(result, mm, false);
empty = false;
}
if ((attributes & FETCH_BODYSTRUCTURE) != 0) {
result.print(empty ? "" : " ");
result.print("BODYSTRUCTURE ");
ImapMessage.serializeStructure(result, mm, true);
empty = false;
}
if ((attributes & FETCH_ENVELOPE) != 0) {
result.print(empty ? "" : " ");
result.print("ENVELOPE ");
ImapMessage.serializeEnvelope(result, mm);
empty = false;
}
if (parts != null) {
for (ImapPartSpecifier pspec : parts) {
result.print(empty ? "" : " ");
pspec.write(result, output, mm);
empty = false;
}
}
}
// FIXME: optimize by doing a single mark-read op on multiple messages
if (markMessage) {
String folderOwner = i4folder.getFolder().getFolderItemIdentifier().accountId;
ItemIdentifier iid = ItemIdentifier.fromAccountIdAndItemId((folderOwner != null) ? folderOwner : mbox.getAccountId(), i4msg.msgId);
mbox.flagItemAsRead(getContext(), iid, i4msg.getMailItemType());
}
ImapFolder.DirtyMessage unsolicited = i4folder.undirtyMessage(i4msg);
if ((attributes & FETCH_FLAGS) != 0 || unsolicited != null) {
result.print(empty ? "" : " ");
result.print(i4msg.getFlags(i4folder));
empty = false;
}
// data items in all subsequent unsolicited FETCH responses."
if ((attributes & FETCH_MODSEQ) != 0 || (modseqEnabled && unsolicited != null)) {
int modseq = unsolicited == null ? item.getModifiedSequence() : unsolicited.modseq;
result.print((empty ? "" : " ") + "MODSEQ (" + modseq + ')');
empty = false;
}
} catch (ImapPartSpecifier.BinaryDecodingException e) {
// don't write this response line if we're returning NO
result = null;
throw new ImapParseException(tag, "UNKNOWN-CTE", command + "failed: unknown content-type-encoding", false);
} catch (SoapFaultException e) {
fetchException(e);
} catch (ServiceException e) {
Throwable cause = e.getCause();
if (cause instanceof IOException) {
fetchException(cause);
} else {
ZimbraLog.imap.warn("ignoring error during " + command + ": ", e);
continue;
}
} catch (MessagingException e) {
ZimbraLog.imap.warn("ignoring error during " + command + ": ", e);
continue;
} catch (IOException ioe) {
fetchException(ioe);
} finally {
if (result != null) {
result.write(')');
output.write(LINE_SEPARATOR_BYTES, 0, LINE_SEPARATOR_BYTES.length);
output.flush();
}
}
}
} finally {
if (lock != null) {
lock.unlock();
}
}
if (standalone) {
sendNotifications(byUID, false);
sendOK(tag, command + " completed");
}
return true;
}
use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class ImapURL method getContentAsStream.
public InputStreamWithSize getContentAsStream(ImapHandler handler, ImapCredentials creds, String tag) throws ImapException {
ImapHandler.State state = handler.getState();
if (state == ImapHandler.State.NOT_AUTHENTICATED) {
throw new ImapUrlException(tag, mURL, "must be in AUTHENTICATED state");
}
try {
Account acct = Provisioning.getInstance().get(AccountBy.name, mUsername);
if (acct == null) {
throw new ImapUrlException(tag, mURL, "cannot find user: " + mUsername);
}
ImapListener i4session = handler.getCurrentImapListener();
OperationContext octxt = creds.getContext().setSession(i4session);
InputStreamWithSize content = null;
// special-case the situation where the relevant folder is already SELECTed
ImapFolder i4folder = handler.getSelectedFolder();
if (state == ImapHandler.State.SELECTED && (i4session != null) && (i4folder != null) && acct.getId().equals(i4session.getTargetAccountId()) && mPath.isEquivalent(i4folder.getPath())) {
ImapMessage i4msg = i4folder.getByImapId(mUid);
if (i4msg == null || i4msg.isExpunged()) {
throw new ImapUrlException(tag, mURL, "no such message");
}
MailboxStore i4Mailbox = i4folder.getMailbox();
ZimbraMailItem item = i4Mailbox.getItemById(octxt, ItemIdentifier.fromAccountIdAndItemId(i4Mailbox.getAccountId(), i4msg.msgId), i4msg.getMailItemType());
content = ImapMessage.getContent(item);
}
// if not, have to fetch by IMAP UID if we're local or handle off-server URLs
if (content == null) {
ImapMailboxStore mbox = mPath.getOwnerImapMailboxStore();
content = mbox.getByImapId(octxt, mUid, mPath.getFolder().getFolderIdAsString(), mPath.asResolvedPath());
if (null == content) {
throw new ImapUrlException(tag, mURL, "no such message");
}
}
// fetch the content of the message
if (mPart == null) {
return content;
}
// and return the appropriate subpart of the selected message
MimeMessage mm;
try {
mm = new Mime.FixedMimeMessage(JMSession.getSession(), content.stream);
} finally {
content.stream.close();
}
InputStreamWithSize part = mPart.getContentOctetRange(mm);
if (part == null) {
throw new ImapUrlException(tag, mURL, "no such part");
}
return part;
} catch (NoSuchItemException e) {
ZimbraLog.imap.info("no such message", e);
} catch (ServiceException | MessagingException | BinaryDecodingException e) {
ZimbraLog.imap.info("can't fetch content from IMAP URL", e);
} catch (IOException e) {
ZimbraLog.imap.info("error reading content from IMAP URL", e);
}
throw new ImapUrlException(tag, mURL, "error fetching IMAP URL content");
}
use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class PendingLocalModifications method add.
@Override
PendingModifications<MailItem> add(PendingModifications<MailItem> other) {
changedTypes.addAll(other.changedTypes);
addChangedParentFolderIds(other.getChangedParentFolders());
if (other.deleted != null) {
for (Map.Entry<PendingModifications.ModificationKey, PendingModifications.Change> entry : other.deleted.entrySet()) {
delete(entry.getKey(), entry.getValue());
}
}
if (other.created != null) {
for (BaseItemInfo item : other.created.values()) {
recordCreated(item);
}
}
if (other.modified != null) {
for (PendingModifications.Change chg : other.modified.values()) {
if (chg.what instanceof ZimbraMailItem) {
recordModified((ZimbraMailItem) chg.what, chg.why, (ZimbraMailItem) chg.preModifyObj);
} else if (chg.what instanceof Mailbox) {
recordModified((Mailbox) chg.what, chg.why);
}
}
}
return this;
}
use of com.zimbra.common.mailbox.ZimbraMailItem in project zm-mailbox by Zimbra.
the class TestZClient method testZMailboxGetItemById.
@Test
public void testZMailboxGetItemById() throws Exception {
Mailbox mbox = TestUtil.getMailbox(USER_NAME);
ZMailbox zmbox = TestUtil.getZMailbox(USER_NAME);
Integer id = Integer.valueOf(TestUtil.addMessage(zmbox, "testGetItemById test msg"));
ItemIdentifier msgItemId = ItemIdentifier.fromAccountIdAndItemId(zmbox.getAccountId(), id);
Contact contact = TestUtil.createContactInDefaultFolder(mbox, "testzclient@example.com");
ItemIdentifier contactId = ItemIdentifier.fromAccountIdAndItemId(zmbox.getAccountId(), contact.getId());
/* getting message using message id */
ZimbraMailItem mItemAsMsg = zmbox.getItemById((OpContext) null, msgItemId, MailItemType.MESSAGE);
assertNotNull("getItemById returned null when got with type MESSAGE", mItemAsMsg);
assertEquals("Different ID when got with type MESSAGE", id, Integer.valueOf(mItemAsMsg.getIdInMailbox()));
assertTrue(String.format("%s Not a ZMessage when got with type MESSAGE", mItemAsMsg.getClass().getName()), mItemAsMsg instanceof ZMessage);
/* getting item using message id */
mItemAsMsg = zmbox.getItemById((OpContext) null, msgItemId, MailItemType.UNKNOWN);
assertNotNull("getItemById returned null when got with type UNKNOWN", mItemAsMsg);
assertEquals("Different ID when got with type UNKNOWN", id, Integer.valueOf(mItemAsMsg.getIdInMailbox()));
assertTrue(String.format("%s Not a ZMessage when got with type UNKNOWN", mItemAsMsg.getClass().getName()), mItemAsMsg instanceof ZMessage);
/* getting contact using id of contact */
ZimbraMailItem mItemAsContact = zmbox.getItemById((OpContext) null, contactId, MailItemType.CONTACT);
assertNotNull("getItemById returned null when got with type CONTACT", mItemAsContact);
assertEquals("Different ID when got with type CONTACT", contactId.id, mItemAsContact.getIdInMailbox());
assertTrue(String.format("%s Not a ZContact when got with type CONTACT", mItemAsContact.getClass().getName()), mItemAsContact instanceof ZContact);
ZContact zContact = (ZContact) mItemAsContact;
assertEquals("Imap UID of ZContact should be same as Contact", contact.getImapUid(), zContact.getImapUid());
assertTrue(String.format("IMAP UID %s of ZContact not 0", zContact.getImapUid()), 0 != zContact.getImapUid());
/* getting message using contact id */
try {
zmbox.getItemById((OpContext) null, contactId, MailItemType.MESSAGE);
fail("ZClientNoSuchItemException was not thrown when getting contact as message");
} catch (ZClientException.ZClientNoSuchItemException zcnsie) {
}
/* getting message using non-existent id */
ItemIdentifier nonexistent = ItemIdentifier.fromAccountIdAndItemId(zmbox.getAccountId(), 9099);
try {
zmbox.getItemById((OpContext) null, nonexistent, MailItemType.UNKNOWN);
fail("ZClientNoSuchItemException was not thrown");
} catch (ZClientException.ZClientNoSuchItemException zcnsie) {
}
/* getting contact using id of message */
try {
zmbox.getItemById((OpContext) null, msgItemId, MailItemType.CONTACT);
fail("ZClientNoSuchItemException was not thrown");
} catch (ZClientException.ZClientNoSuchContactException zcnsce) {
}
/* getting document using id of message */
try {
zmbox.getItemById((OpContext) null, msgItemId, MailItemType.DOCUMENT);
fail("ZClientNoSuchItemException was not thrown");
} catch (ZClientException.ZClientNoSuchItemException zcnsce) {
}
}
Aggregations