SMTPClient incorrectly putting stack trace into the message of a MailException it raises

Description

Copied from Slack

It seems to me that when we get a timeout connecting to our mail server, an exception is thrown - good - but the exception message from Lucee contains the entire Java stack trace.

This is on Lucee 5.3.7.47

EG:

Lucee 5.3.7.47 Error (lucee.runtime.net.mail.MailException) Message smtp.example.com timeout occurred after 5 seconds while sending mail message javax.mail.MessagingException: timeout occurred after 5 seconds while sending mail message at lucee.runtime.net.smtp.SMTPClient._send(SMTPClient.java:844) at lucee.runtime.net.smtp.SMTPClient.send(SMTPClient.java:731) at lucee.runtime.tag.Mail.doEndTag(Mail.java:582) etc

To be clear… all of that text (and the entire rest of the stack trace) are in the message part of that exception.

I tracked it down to this bit of code:

MailException me = new MailException(server.getHostName() + " " + ExceptionUtil.getStacktrace(e, true) + ":" + i);

Please just put a message in the message property; and put the stack trace in its own property.

Cheers.

Environment

None

Activity

Show:

Pothys - MitrahSoft 11 February 2022 at 07:32

I've checked this ticket and the issue was solved on the lucee latest version 5.3.9.80-SNAPSHOT.

Pothys - MitrahSoft 17 January 2022 at 10:55

This issue fixed on 6.0.0.151-SNAPSHOT and not fixed in 5.3.

PR for 5.3: https://github.com/lucee/Lucee/pull/1521

Pothys - MitrahSoft 22 December 2021 at 14:29
Edited

I added a fix to this ticket
Pull Request: https://github.com/lucee/Lucee/pull/1497

Fixed

Details

Assignee

Reporter

Priority

Fix versions

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

Sprint

Affects versions

Created 6 December 2021 at 17:40
Updated 11 February 2022 at 07:32
Resolved 11 February 2022 at 07:32

Flag notifications