Skip to content

Loading…

DS-1873: Minor fixes for Checksum Checker Daily Report Emailer. #442

Merged
merged 1 commit into from

2 participants

@tdonohue
DSpace Repository member
  1. Ensure it only sends an email if there's a possible issue.
  2. Also include "dspace.hostname" in email subject, so you can tell which DSpace site sent the email.

More info at: https://jira.duraspace.org/browse/DS-1873

@tdonohue tdonohue Minor fixes for Checksum Checker Daily Report Emailer. Ensure it only…
… sends an email if there's a possible issue. Also include DSpace hostname in email subject.
a27d40c
@mwoodiupui
DSpace Repository member

+1

@tdonohue tdonohue merged commit 8f35788 into DSpace:master

1 check passed

Details default The Travis CI build passed
@tdonohue tdonohue deleted the tdonohue:DS-1873 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 21, 2014
  1. @tdonohue

    Minor fixes for Checksum Checker Daily Report Emailer. Ensure it only…

    tdonohue committed
    … sends an email if there's a possible issue. Also include DSpace hostname in email subject.
Showing with 10 additions and 6 deletions.
  1. +10 −6 dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java
View
16 dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java
@@ -65,12 +65,16 @@ public DailyReportEmailer()
public void sendReport(File attachment, int numberOfBitstreams)
throws IOException, javax.mail.MessagingException
{
- Email email = new Email();
- email.setSubject("Checksum checker Report - " + numberOfBitstreams + " Bitstreams found with POSSIBLE issues");
- email.setContent("report is attached ...");
- email.addAttachment(attachment, "checksum_checker_report.txt");
- email.addRecipient(ConfigurationManager.getProperty("mail.admin"));
- email.send();
+ if(numberOfBitstreams > 0)
+ {
+ String hostname = ConfigurationManager.getProperty("dspace.hostname");
+ Email email = new Email();
+ email.setSubject("Checksum checker Report - " + numberOfBitstreams + " Bitstreams found with POSSIBLE issues on " + hostname);
+ email.setContent("report is attached ...");
+ email.addAttachment(attachment, "checksum_checker_report.txt");
+ email.addRecipient(ConfigurationManager.getProperty("mail.admin"));
+ email.send();
+ }
}
/**
Something went wrong with that request. Please try again.