Skip to content

Package: IMAPNestedMessage

IMAPNestedMessage

nameinstructionbranchcomplexitylinemethod
IMAPNestedMessage(IMAPMessage, BODYSTRUCTURE, ENVELOPE, String)
M: 21 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
checkExpunged()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getFetchBlockSize()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getMessageCacheLock()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getProtocol()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSequenceNumber()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSize()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
ignoreBodyStructureSize()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isExpunged()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isREV1()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setFlags(Flags, boolean)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.eclipse.angus.mail.imap;
18:
19: import jakarta.mail.*;
20: import org.eclipse.angus.mail.imap.protocol.*;
21: import org.eclipse.angus.mail.iap.ProtocolException;
22: import org.eclipse.angus.mail.imap.protocol.BODYSTRUCTURE;
23: import org.eclipse.angus.mail.imap.protocol.ENVELOPE;
24: import org.eclipse.angus.mail.imap.protocol.IMAPProtocol;
25:
26: /**
27: * This class implements a nested IMAP message
28: *
29: * @author John Mani
30: */
31:
32: public class IMAPNestedMessage extends IMAPMessage {
33: private IMAPMessage msg; // the enclosure of this nested message
34:
35: /**
36: * Package private constructor. <p>
37: *
38: * Note that nested messages have no containing folder, nor
39: * a message number.
40: */
41: IMAPNestedMessage(IMAPMessage m, BODYSTRUCTURE b, ENVELOPE e, String sid) {
42:         super(m._getSession());
43:         msg = m;
44:         bs = b;
45:         envelope = e;
46:         sectionId = sid;
47:         setPeek(m.getPeek());
48: }
49:
50: /*
51: * Get the enclosing message's Protocol object. Overrides
52: * IMAPMessage.getProtocol().
53: */
54: @Override
55: protected IMAPProtocol getProtocol()
56:                         throws ProtocolException, FolderClosedException {
57:         return msg.getProtocol();
58: }
59:
60: /*
61: * Is this an IMAP4 REV1 server?
62: */
63: @Override
64: protected boolean isREV1() throws FolderClosedException {
65:         return msg.isREV1();
66: }
67:
68: /*
69: * Get the enclosing message's messageCacheLock. Overrides
70: * IMAPMessage.getMessageCacheLock().
71: */
72: @Override
73: protected Object getMessageCacheLock() {
74:         return msg.getMessageCacheLock();
75: }
76:
77: /*
78: * Get the enclosing message's sequence number. Overrides
79: * IMAPMessage.getSequenceNumber().
80: */
81: @Override
82: protected int getSequenceNumber() {
83:         return msg.getSequenceNumber();
84: }
85:
86: /*
87: * Check whether the enclosing message is expunged. Overrides
88: * IMAPMessage.checkExpunged().
89: */
90: @Override
91: protected void checkExpunged() throws MessageRemovedException {
92:         msg.checkExpunged();
93: }
94:
95: /*
96: * Check whether the enclosing message is expunged. Overrides
97: * Message.isExpunged().
98: */
99: @Override
100: public boolean isExpunged() {
101:         return msg.isExpunged();
102: }
103:
104: /*
105: * Get the enclosing message's fetchBlockSize.
106: */
107: @Override
108: protected int getFetchBlockSize() {
109:         return msg.getFetchBlockSize();
110: }
111:
112: /*
113: * Get the enclosing message's ignoreBodyStructureSize.
114: */
115: @Override
116: protected boolean ignoreBodyStructureSize() {
117:         return msg.ignoreBodyStructureSize();
118: }
119:
120: /*
121: * IMAPMessage uses RFC822.SIZE. We use the "size" field from
122: * our BODYSTRUCTURE.
123: */
124: @Override
125: public int getSize() throws MessagingException {
126:         return bs.size;
127: }
128:
129: /*
130: * Disallow setting flags on nested messages
131: */
132: @Override
133: public synchronized void setFlags(Flags flag, boolean set)
134:                         throws MessagingException {
135:         // Cannot set FLAGS on a nested IMAP message        
136:         throw new MethodNotSupportedException(
137:                 "Cannot set flags on this nested message");
138: }
139: }