Skip to content

Package: DefaultFolder

DefaultFolder

nameinstructionbranchcomplexitylinemethod
DefaultFolder(POP3Store)
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%
appendMessages(Message[])
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%
close(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%
create(int)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
delete(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%
exists()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
expunge()
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%
getFolder(String)
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getFullName()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getInbox()
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%
getMessage(int)
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%
getMessageCount()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getName()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getParent()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPermanentFlags()
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%
getSeparator()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getType()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
hasNewMessages()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isOpen()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
list(String)
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
open(int)
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%
renameTo(Folder)
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.pop3;
18:
19: import jakarta.mail.*;
20:
21: /**
22: * The POP3 DefaultFolder. Only contains the "INBOX" folder.
23: *
24: * @author Christopher Cotton
25: */
26: public class DefaultFolder extends Folder {
27:
28: DefaultFolder(POP3Store store) {
29:         super(store);
30: }
31:
32: @Override
33: public String getName() {
34:         return "";
35: }
36:
37: @Override
38: public String getFullName() {
39:         return "";
40: }
41:
42: @Override
43: public Folder getParent() {
44:         return null;
45: }
46:
47: @Override
48: public boolean exists() {
49:         return true;
50: }
51:
52: @Override
53: public Folder[] list(String pattern) throws MessagingException {
54:         Folder[] f = { getInbox() };
55:         return f;
56: }
57:
58: @Override
59: public char getSeparator() {
60:         return '/';
61: }
62:
63: @Override
64: public int getType() {
65:         return HOLDS_FOLDERS;
66: }
67:
68: @Override
69: public boolean create(int type) throws MessagingException {
70:         return false;
71: }
72:
73: @Override
74: public boolean hasNewMessages() throws MessagingException {
75:         return false;
76: }
77:
78: @Override
79: public Folder getFolder(String name) throws MessagingException {
80:•        if (!name.equalsIgnoreCase("INBOX")) {
81:          throw new MessagingException("only INBOX supported");
82:         } else {
83:          return getInbox();
84:         }
85: }
86:
87: protected Folder getInbox() throws MessagingException {
88:         return getStore().getFolder("INBOX");
89: }
90:
91:
92: @Override
93: public boolean delete(boolean recurse) throws MessagingException {
94:         throw new MethodNotSupportedException("delete");
95: }
96:
97: @Override
98: public boolean renameTo(Folder f) throws MessagingException {
99:         throw new MethodNotSupportedException("renameTo");
100: }
101:
102: @Override
103: public void open(int mode) throws MessagingException {
104:         throw new MethodNotSupportedException("open");
105: }
106:
107: @Override
108: public void close(boolean expunge) throws MessagingException {
109:         throw new MethodNotSupportedException("close");
110: }
111:
112: @Override
113: public boolean isOpen() {
114:         return false;
115: }
116:
117: @Override
118: public Flags getPermanentFlags() {
119:         return new Flags(); // empty flags object
120: }
121:
122: @Override
123: public int getMessageCount() throws MessagingException {
124:         return 0;
125: }
126:
127: @Override
128: public Message getMessage(int msgno) throws MessagingException {
129:         throw new MethodNotSupportedException("getMessage");
130: }
131:
132: @Override
133: public void appendMessages(Message[] msgs) throws MessagingException {
134:         throw new MethodNotSupportedException("Append not supported");        
135: }
136:
137: @Override
138: public Message[] expunge() throws MessagingException {
139:         throw new MethodNotSupportedException("expunge");        
140: }
141: }