MCPcopy Create free account
hub / github.com/M66B/FairEmail / fetchItem

Method fetchItem

app/src/main/java/com/sun/mail/imap/IMAPMessage.java:1441–1485  ·  view source on GitHub ↗

Fetch an individual item for the current message. Note that handleExtensionFetchItems will have been called to store this item in the message before this method returns. @param fitem the FetchItem @return the data associated with the FetchItem @exception MessagingException for failures @since Java

(FetchItem fitem)

Source from the content-addressed store, hash-verified

1439 * @since JavaMail 1.4.6
1440 */
1441 protected Object fetchItem(FetchItem fitem)
1442 throws MessagingException {
1443
1444 // Acquire MessageCacheLock, to freeze seqnum.
1445 synchronized(getMessageCacheLock()) {
1446 Object robj = null;
1447
1448 try {
1449 IMAPProtocol p = getProtocol();
1450
1451 checkExpunged(); // Insure that this message is not expunged
1452
1453 int seqnum = getSequenceNumber();
1454 Response[] r = p.fetch(seqnum, fitem.getName());
1455
1456 for (int i = 0; i < r.length; i++) {
1457 // If this response is NOT a FetchResponse or if it does
1458 // not match our seqnum, skip.
1459 if (r[i] == null ||
1460 !(r[i] instanceof FetchResponse) ||
1461 ((FetchResponse)r[i]).getNumber() != seqnum)
1462 continue;
1463
1464 FetchResponse f = (FetchResponse)r[i];
1465 handleExtensionFetchItems(f.getExtensionItems());
1466 if (items != null) {
1467 Object o = items.get(fitem.getName());
1468 if (o != null)
1469 robj = o;
1470 }
1471 }
1472
1473 // ((IMAPFolder)folder).handleResponses(r);
1474 p.notifyResponseHandlers(r);
1475 p.handleResult(r[r.length - 1]);
1476 } catch (ConnectionException cex) {
1477 throw new FolderClosedException(folder, cex.getMessage());
1478 } catch (ProtocolException pex) {
1479 forceCheckExpunged();
1480 throw new MessagingException(pex.getMessage(), pex);
1481 }
1482 return robj;
1483
1484 } // Release MessageCacheLock
1485 }
1486
1487 /**
1488 * Return the data associated with the FetchItem.

Callers 1

getItemMethod · 0.95

Calls 14

getMessageCacheLockMethod · 0.95
getProtocolMethod · 0.95
checkExpungedMethod · 0.95
getSequenceNumberMethod · 0.95
fetchMethod · 0.95
getExtensionItemsMethod · 0.95
forceCheckExpungedMethod · 0.95
handleResultMethod · 0.80
getNameMethod · 0.65
getMessageMethod · 0.65

Tested by

no test coverage detected