Outbound email - protected against testMessageTo being null

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@47456 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2013-03-01 17:46:13 +00:00
parent 3373456c13
commit 583ddc80ee
2 changed files with 17 additions and 1 deletions

View File

@@ -271,6 +271,18 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
*/
public boolean sendTestMessage()
{
if(testMessageTo == null || testMessageTo.length() == 0)
{
throw new AlfrescoRuntimeException("email.outbound.err.test.no.to");
}
if(testMessageSubject == null || testMessageSubject.length() == 0)
{
throw new AlfrescoRuntimeException("email.outbound.err.test.no.subject");
}
if(testMessageText == null || testMessageText.length() == 0)
{
throw new AlfrescoRuntimeException("email.outbound.err.test.no.text");
}
Map<String, Serializable> params = new HashMap<String, Serializable>();
params.put(PARAM_TO, testMessageTo);
params.put(PARAM_SUBJECT, testMessageSubject);
@@ -314,7 +326,7 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
numberFailedSends.set(0);
super.init();
if (sendTestMessage)
if (sendTestMessage && testMessageTo != null)
{
Map<String, Serializable> params = new HashMap<String, Serializable>();
params.put(PARAM_TO, testMessageTo);