Skip to content
Snippets Groups Projects
Commit 20a0ee0b authored by buczekp's avatar buczekp
Browse files

[LMS-2301] improved error handling and null recipient email (e.g. 'test' user doesn't have email)

SVN: 22050
parent db4a77f7
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,6 @@ import java.util.Properties; ...@@ -22,7 +22,6 @@ import java.util.Properties;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import ch.systemsx.cisd.common.evaluator.EvaluatorException;
import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogCategory;
import ch.systemsx.cisd.common.logging.LogFactory; import ch.systemsx.cisd.common.logging.LogFactory;
...@@ -109,7 +108,7 @@ public class JythonBasedReportingPlugin extends AbstractTableModelReportingPlugi ...@@ -109,7 +108,7 @@ public class JythonBasedReportingPlugin extends AbstractTableModelReportingPlugi
operationLog.info("Reporting done"); operationLog.info("Reporting done");
JythonBasedPluginUtils.closeContent(iDataSets); JythonBasedPluginUtils.closeContent(iDataSets);
} }
} catch (EvaluatorException ex) } catch (RuntimeException ex)
{ {
notifyLog.error(ex.getMessage()); notifyLog.error(ex.getMessage());
throw new UserFailureException("Chosen plugin failed to create a report."); throw new UserFailureException("Chosen plugin failed to create a report.");
......
...@@ -45,16 +45,15 @@ public class MailService implements IMailService ...@@ -45,16 +45,15 @@ public class MailService implements IMailService
private final String defaultBodyText; private final String defaultBodyText;
public MailService(IMailClient mailClient, String recipientAddress) public MailService(IMailClient mailClient, String recipientAddressOrNull)
{ {
this(mailClient, recipientAddress, DEFAULT_SUBJECT, DEFAULT_BODY_TEXT); this(mailClient, recipientAddressOrNull, DEFAULT_SUBJECT, DEFAULT_BODY_TEXT);
} }
public MailService(IMailClient mailClient, String recipientAddress, String defaultSubject, public MailService(IMailClient mailClient, String recipientAddressOrNull,
String defaultBodyText) String defaultSubject, String defaultBodyText)
{ {
assert recipientAddress != null; this.senderService = createEmailSenderService(mailClient, recipientAddressOrNull);
this.senderService = createEmailSenderService(mailClient, recipientAddress);
this.defaultSubject = defaultSubject; this.defaultSubject = defaultSubject;
this.defaultBodyText = defaultBodyText; this.defaultBodyText = defaultBodyText;
} }
...@@ -65,9 +64,9 @@ public class MailService implements IMailService ...@@ -65,9 +64,9 @@ public class MailService implements IMailService
} }
static IEmailSenderService createEmailSenderService(final IMailClient mailClient, static IEmailSenderService createEmailSenderService(final IMailClient mailClient,
final String recipientAddress) final String recipientAddressOrNull)
{ {
final EMailAddress recipient = new EMailAddress(recipientAddress); final EMailAddress recipient = new EMailAddress(recipientAddressOrNull);
return new IEmailSenderService() return new IEmailSenderService()
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment