Check for optional.isPresent() before calling any public mailer methods#1003
Check for optional.isPresent() before calling any public mailer methods#1003
Conversation
|
Should we remove other checks to compensate for this check? |
|
I was thinking that - it could be redundant to check in the private methods now that the public methods all check. |
| } | ||
|
|
||
| public void sendRequestRemovedMail(SingularityRequest request, Optional<String> user, Optional<String> message) { | ||
| if (!maybeSmtpConfiguration.isPresent()) { |
There was a problem hiding this comment.
this one isn't needed, we check in the first line of sendRequestMail
There was a problem hiding this comment.
Actually, I was going to remove the check in sendRequestMail and leave those in.
The justification being that I'd rather have it be standard that the public methods check and then can safely call the private methods than split between the two.
There was a problem hiding this comment.
Ah, fair enough. yeah, can put it at the beginning of the public methods for readability
| } | ||
|
|
||
| public void sendRequestUnpausedMail(SingularityRequest request, Optional<String> user, Optional<String> message) { | ||
| if (!maybeSmtpConfiguration.isPresent()) { |
There was a problem hiding this comment.
similar for check in first line of sendRequestMail
|
Closing in favor of #1004 |
Fixes #1001 by checking if smtpConfig is absent before allowing any public smtp methods to be called.