Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8502081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:23:12+00:00 2026-06-11T01:23:12+00:00

Upon calling the following I code snipit: Message message_in = null; inbox instanceof IMAPFolder

  • 0

Upon calling the following I code snipit:

Message message_in  = null;
inbox instanceof IMAPFolder
IMAPFolder f = (IMAPFolder)inbox;
f.idle();
System.out.println("IDLE done");                                              
message_in = inbox.getMessage(inbox.getMessageCount());
message_in.setFlag(Flags.Flag.DELETED, true);
inbox.expunge();

I receive the error message:

Got 1 new messages
***********************************************************
------------ Message 1 ------------
DONE
A4 OK IDLE completed.
A5 FETCH 13 (ENVELOPE INTERNALDATE RFC822.SIZE)
IDLE done
* 13 FETCH (ENVELOPE ("Wed, 29 Aug 2012 13:25:15 -0500" "Doc Com: Voice msg from Outside caller 5555555555 Unread:2" (("Support" NIL "support" "example.com")) NIL NIL (("Support" NIL "support" "example.com")) NIL NIL "<94BA85B8-FC4D-4193-B386-7FD2C1DE1B1F@example.com>" "<873439BD-8640-47D9-BF88-5FD3521B8173@example.com>") INTERNALDATE "29-Aug-2012 13:25:17 -0500" RFC822.SIZE 967)
A5 OK FETCH completed.
A6 STORE 13 +FLAGS (\Deleted)
* 13 FETCH (FLAGS (\Deleted \Recent))
A6 OK STORE completed.
A7 EXPUNGE
* 13 EXPUNGE
* 12 EXPUNGE
* 11 EXPUNGE
* 10 EXPUNGE
* 9 EXPUNGE
* 8 EXISTS
A7 OK EXPUNGE completed.
javax.mail.MessageRemovedException
    at com.sun.mail.imap.IMAPMessage.checkExpunged(IMAPMessage.java:205)
    at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1305)
    at com.sun.mail.imap.IMAPMessage.getContentType(IMAPMessage.java:450)
    at javax.mail.internet.MimeBodyPart.isMimeType(MimeBodyPart.java:1050)
    at javax.mail.internet.MimeMessage.isMimeType(MimeMessage.java:986)
    at com.example.vmmonitor.main.VMMonitor.getText(VMMonitor.java:211)
    at com.example.vmmonitor.main.VMMonitor.access$000(VMMonitor.java:27)
    at com.example.vmmonitor.main.VMMonitor$1.messagesAdded(VMMonitor.java:109)
    at javax.mail.event.MessageCountEvent.dispatch(MessageCountEvent.java:150)
    at javax.mail.EventQueue.run(EventQueue.java:134)
    at java.lang.Thread.run(Thread.java:680)
DEBUG IMAP: IMAPProtocol noop

I was able to patch the issues by adding a Thread.sleep() as follows:

What is the issue? Why am I able to flag a message as DELETED but I am not able to expunge the mailbox?

Message message_in  = null;
inbox instanceof IMAPFolder
IMAPFolder f = (IMAPFolder)inbox;
f.idle();
System.out.println("IDLE done");                                              
message_in = inbox.getMessage(inbox.getMessageCount());
message_in.setFlag(Flags.Flag.DELETED, true);
Thread.sleep(2000);/*****************bug patch***********/
inbox.expunge();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:23:13+00:00Added an answer on June 11, 2026 at 1:23 am

    This multithreaded program is not accessing the inbox resource in a non-thread safe manor. The program is defined in a manor such that inbox.expunge(); and an additional functioning are mutually accessing the mailbox and hence the exception is thrown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Upon calling the following I code snipit: Message message_in = null; inbox instanceof IMAPFolder
I am following this example . I keep getting this error whenever calling upon
In a few examples of code I have seen the following when calling a
I've got the following code in one of my view controllers: - (void)tableView:(UITableView *)tableView
I have stumbled upon a problem when calling a nested Async which happens to
I'm having a devil of a time understanding references. Consider the following code: class
In our code we do the following: - (void) createComment:(NSString *)comment ForId:(NSString *)objectId {
Upon user login I check their roles. If they have no roles I want
Upon visiting an older site it can be common to find deprecated tags and
Upon considering the driver side implementation for DirectX API on windows systems for modern

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.