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

Method close

app/src/main/java/com/sun/mail/pop3/POP3Folder.java:230–288  ·  view source on GitHub ↗
(boolean expunge)

Source from the content-addressed store, hash-verified

228 }
229
230 @Override
231 public synchronized void close(boolean expunge) throws MessagingException {
232 checkOpen();
233
234 try {
235 /*
236 * Some POP3 servers will mark messages for deletion when
237 * they're read. To prevent such messages from being
238 * deleted before the client deletes them, you can set
239 * the mail.pop3.rsetbeforequit property to true. This
240 * causes us to issue a POP3 RSET command to clear all
241 * the "marked for deletion" flags. We can then explicitly
242 * delete messages as desired.
243 */
244 if (store.rsetBeforeQuit && !forceClose)
245 port.rset();
246 POP3Message m;
247 if (expunge && mode == READ_WRITE && !forceClose) {
248 // find all messages marked deleted and issue DELE commands
249 for (int i = 0; i < message_cache.length; i++) {
250 if ((m = message_cache[i]) != null) {
251 if (m.isSet(Flags.Flag.DELETED))
252 try {
253 port.dele(i + 1);
254 } catch (IOException ioex) {
255 throw new MessagingException(
256 "Exception deleting messages during close",
257 ioex);
258 }
259 }
260 }
261 }
262
263 /*
264 * Flush and free all cached data for the messages.
265 */
266 for (int i = 0; i < message_cache.length; i++) {
267 if ((m = message_cache[i]) != null)
268 m.invalidate(true);
269 }
270
271 if (forceClose)
272 port.close();
273 else
274 port.quit();
275 } catch (IOException ex) {
276 // do nothing
277 } finally {
278 port = null;
279 store.closePort(this);
280 message_cache = null;
281 opened = false;
282 notifyConnectionListeners(ConnectionEvent.CLOSED);
283 if (fileCache != null) {
284 fileCache.close();
285 fileCache = null;
286 }
287 }

Callers 5

isOpenMethod · 0.95
fetchMethod · 0.95
getUIDMethod · 0.95
finalizeMethod · 0.95
getSizesMethod · 0.45

Calls 8

checkOpenMethod · 0.95
invalidateMethod · 0.95
rsetMethod · 0.80
deleMethod · 0.80
closePortMethod · 0.80
isSetMethod · 0.45
quitMethod · 0.45

Tested by

no test coverage detected