Bug #3400
closedsaxon:send-mail fails with NullPointerException if any configuration options are absent
100%
Description
Created test case (in xslt3extra test suite) send-mail-001.
The code in checkMailProperty reads a property from the options map and fails with an NPE if it is absent.
Updated by Michael Kay over 6 years ago
Also, the "cc" option appears to be missing from the documentation.
Updated by Michael Kay over 6 years ago
Also, the example in the documentation uses the old map syntax with :=" rather than
Updated by Michael Kay over 6 years ago
- Status changed from New to In Progress
I have rewritten the way that the SendMail function processes its first argument, to exploit the utility class OptionsParameter which is used to support all 3.1 functions having a map-valued options parameter.
I have changed boolean-valued parameters like "html" to accept a boolean, and integer-valued parameters like "port" to accept an integer, but for backwards compatibility I've retained the ability to convert this from a string by means of a new feature in the OptionsParameter class.
I've also added to the OptionsParameter class the ability to declare that certain properties are mandatory. We still need to review which parameters should be mandatory: I'm not sure for example whether it makes sense for username and password to be omitted.
I've extended the implementation so that if the first argument contains any (string-valued) property whose name begins with "mail.", it is copied to the properties supplied to the call on Session.getDefaultInstance(), to allow setting of properties such as "mail.smtp.timeout".
These changes need to be documented.
Updated by Michael Kay over 6 years ago
I have committed these changes to 9.8 as they appear to cause no regression, but before closing the issue we need
(a) to update the documentation
(b) to review exactly which of the mail parameters should be marked as required, and which can sensibly be omitted or defaulted.
Updated by Michael Kay over 6 years ago
- Assignee changed from Michael Kay to O'Neil Delpratt
Updated by O'Neil Delpratt over 6 years ago
Michael Kay wrote:
I have committed these changes to 9.8 as they appear to cause no regression, but before closing the issue we need
(a) to update the documentation
(b) to review exactly which of the mail parameters should be marked as required, and which can sensibly be omitted or defaulted.
The java mail API documentation gives details are required in the method getDefaultInstance(Properties props) on the Session class.
See: https://javaee.github.io/javamail/docs/api/
Also see: https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html
Which states:
It is expected that the client supplies values for the properties listed in Appendix A of the JavaMail spec (particularly mail.store.protocol, mail.transport.protocol, mail.host, mail.user, and mail.from) as the defaults are unlikely to work in all cases.
See Appendix A: https://javaee.github.io/javamail/docs/JavaMail-1.4.pdf
Key parameters:
-
mail.smtp.user
-
mail.smtp.host (smtp-server)
-
to (is not in the appendix but is still required to send the mail)
Updated by O'Neil Delpratt over 6 years ago
- Status changed from In Progress to Resolved
Marking this as resolved: Documentation and code has been updated.
Updated by O'Neil Delpratt over 6 years ago
- % Done changed from 0 to 100
Bug fix applied in the Saxon 9.8.0.7 maintenance release.
Updated by O'Neil Delpratt over 6 years ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 9.8.0.7 added
Please register to edit this issue