You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/11/02 14:40:17 UTC

[GitHub] [cloudstack] ravening commented on a change in pull request #5649: Handle NullPointerException when sending email alerts

ravening commented on a change in pull request #5649:
URL: https://github.com/apache/cloudstack/pull/5649#discussion_r741130770



##########
File path: framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaAlertManagerImpl.java
##########
@@ -325,14 +326,20 @@ public void sentSuccessfully(final QuotaAccountDao quotaAccountDao) {
         }
     };
 
-    protected void sendQuotaAlert(List<String> emails, String subject, String body) {
+    protected void sendQuotaAlert(String accountUuid, List<String> emails, String subject, String body) {
         SMTPMailProperties mailProperties = new SMTPMailProperties();
 
         mailProperties.setSender(new MailAddress(senderAddress));
         mailProperties.setSubject(subject);
         mailProperties.setContent(body);
         mailProperties.setContentType("text/html; charset=utf-8");
 
+        if (CollectionUtils.isEmpty(emails)) {
+            s_logger.warn(String.format("Unable to send quota alert email with subject [%s] and content [%s]. "

Review comment:
       Not a big deal but `Unable to send quota alert email` might give different meaning like something wrong with email system or configuration but the actual reason is the empty list. Just mentioning that the list is empty should be good enough




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org