Details
Assignee
Michael OffnerMichael OffnerReporter
Brad WoodBrad WoodPriority
NewLabels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Details
Details
Assignee
Michael Offner
Michael OffnerReporter
Brad Wood
Brad WoodPriority
Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Created 6 October 2022 at 18:16
Updated 10 October 2022 at 09:58
This error is eating my lunch on a client integration trying to use cfimap. The call is just something like this
cfimap( server="outlook.office365.com", username="xxx@yyy.com", password="zzz", action="GetAll", attachmentpath="#Save_Path#", name="local.qGetMessages", generateuniquefilenames="yes", maxrows="20", port="993", secure="yes", timeout="30" );
Basically, there is some scenario where the imap connection is failing and already closed BEFORE Lucee tries to close it. When Lucee tries to close, this error happens:
lucee.runtime.exp.NativeException: This operation is not allowed on a closed folder at com.sun.mail.imap.IMAPFolder.close(IMAPFolder.java:1510) at com.sun.mail.imap.IMAPFolder.close(IMAPFolder.java:1484) at lucee.runtime.net.mail.MailClient.getMails(MailClient.java:321) at lucee.runtime.tag._Mail.doStartTag(_Mail.java:269) at models.infaximporter_cfc$cf.udfCall(/autotasks/models/InFaxImporter.cfc:26 ...
You can see the folder.close() is happening inside of a finally block with no regard to whether an exception already happened or testing to see if the folder is still open. Right now, that secondary error is completely hiding the “real” error from us.
https://github.com/lucee/Lucee/blob/5.3/core/src/main/java/lucee/runtime/net/mail/MailClient.java#L321
The easiest fix for now is probably to wrap the folder.close() in its own try catch so any exceptions from the outer try will still be seen.