mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
JavaMailSenderImpl calls sendMessage with empty array instead of null
Issue: SPR-17540
(cherry picked from commit 16e9b83d43)
This commit is contained in:
+5
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import javax.activation.FileTypeMap;
|
||||
import javax.mail.Address;
|
||||
import javax.mail.AuthenticationFailedException;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.NoSuchProviderException;
|
||||
@@ -390,7 +391,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
|
||||
|
||||
/**
|
||||
* Actually send the given array of MimeMessages via JavaMail.
|
||||
* @param mimeMessages MimeMessage objects to send
|
||||
* @param mimeMessages the MimeMessage objects to send
|
||||
* @param originalMessages corresponding original message objects
|
||||
* that the MimeMessages have been created from (with same array
|
||||
* length and indices as the "mimeMessages" array), if any
|
||||
@@ -445,7 +446,8 @@ public class JavaMailSenderImpl implements JavaMailSender {
|
||||
// Preserve explicitly specified message id...
|
||||
mimeMessage.setHeader(HEADER_MESSAGE_ID, messageId);
|
||||
}
|
||||
transport.sendMessage(mimeMessage, mimeMessage.getAllRecipients());
|
||||
Address[] addresses = mimeMessage.getAllRecipients();
|
||||
transport.sendMessage(mimeMessage, (addresses != null ? addresses : new Address[0]));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Object original = (originalMessages != null ? originalMessages[i] : mimeMessage);
|
||||
|
||||
Reference in New Issue
Block a user