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

Method getUID

app/src/main/java/com/sun/mail/imap/IMAPFolder.java:2771–2811  ·  view source on GitHub ↗

Get the UID for the specified message.

(Message message)

Source from the content-addressed store, hash-verified

2769 * Get the UID for the specified message.
2770 */
2771 @Override
2772 public synchronized long getUID(Message message)
2773 throws MessagingException {
2774 if (message.getFolder() != this)
2775 throw new NoSuchElementException(
2776 "Message does not belong to this folder");
2777
2778 checkOpened(); // insure that folder is open
2779
2780 if (!(message instanceof IMAPMessage))
2781 throw new MessagingException("message is not an IMAPMessage");
2782 IMAPMessage m = (IMAPMessage)message;
2783 // If the message already knows its UID, great ..
2784 long uid;
2785 if ((uid = m.getUID()) != -1)
2786 return uid;
2787
2788 synchronized(messageCacheLock) { // Acquire Lock
2789 try {
2790 IMAPProtocol p = getProtocol();
2791 m.checkExpunged(); // insure that message is not expunged
2792 UID u = p.fetchUID(m.getSequenceNumber());
2793
2794 if (u != null) {
2795 uid = u.uid;
2796 m.setUID(uid); // set message's UID
2797
2798 // insert this message into uidTable
2799 if (uidTable == null)
2800 uidTable = new Hashtable<>();
2801 uidTable.put(Long.valueOf(uid), m);
2802 }
2803 } catch (ConnectionException cex) {
2804 throw new FolderClosedException(this, cex.getMessage());
2805 } catch (ProtocolException pex) {
2806 throw new MessagingException(pex.getMessage(), pex);
2807 }
2808 }
2809
2810 return uid;
2811 }
2812
2813 /**
2814 * Servers that support the UIDPLUS extension

Callers

nothing calls this directly

Calls 10

checkOpenedMethod · 0.95
getUIDMethod · 0.95
getProtocolMethod · 0.95
checkExpungedMethod · 0.95
fetchUIDMethod · 0.95
getSequenceNumberMethod · 0.95
setUIDMethod · 0.95
getFolderMethod · 0.65
getMessageMethod · 0.65
putMethod · 0.45

Tested by

no test coverage detected