次のコードを呼び出すと、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();
エラーメッセージが表示されます:
javax.mail.MessagingException: A9 NO Command received in Invalid state.;
nested exception is:
com.sun.mail.iap.CommandFailedException: A9 NO Command received in Invalid state.
at com.sun.mail.imap.IMAPMessage.setFlags(IMAPMessage.java:905)
at javax.mail.Message.setFlag(Message.java:578)
at com.name.vmmonitor.main.VMMonitor.startPolling(VMMonitor.java:160)
at com.name.vmmonitor.main.VMMonitor.main(VMMonitor.java:283)
Caused by: com.sun.mail.iap.CommandFailedException: A9 NO Command received in Invalid state.
at com.sun.mail.iap.Protocol.handleResult(Protocol.java:351)
at com.sun.mail.imap.protocol.IMAPProtocol.storeFlags(IMAPProtocol.java:1589)
at com.sun.mail.imap.protocol.IMAPProtocol.storeFlags(IMAPProtocol.java:1574)
at com.sun.mail.imap.IMAPMessage.setFlags(IMAPMessage.java:901)
... 3 more
どうした?次のようなメソッドを呼び出すことはできますmessage_in.getSubject()
が、なぜmessage_in.setFlag()
ですか?