@@ -53,7 +53,7 @@ public class ReportDiff extends DSpaceRunnable<ReportDiffScriptConfiguration> {
5353
5454 private static final ObjectMapper mapper = new ObjectMapper ();
5555
56- private ReportResultService reportResultService = ContentServiceFactory . getInstance (). getReportResultService () ;
56+ private ReportResultService reportResultService ;
5757 private EPersonService ePersonService ;
5858
5959 /**
@@ -104,6 +104,7 @@ public ReportDiffScriptConfiguration getScriptConfiguration() {
104104 @ Override
105105 public void setup () throws ParseException {
106106 ePersonService = EPersonServiceFactory .getInstance ().getEPersonService ();
107+ reportResultService = ContentServiceFactory .getInstance ().getReportResultService ();
107108 // `-i`: Info, show help information.
108109 if (commandLine .hasOption ('i' )) {
109110 info = true ;
@@ -226,7 +227,7 @@ private boolean validateDateRange() {
226227 handler .logError ("The 'to' date cannot be before the 'from' date." );
227228 return false ;
228229 } else if (Objects .isNull (from ) || Objects .isNull (to )) {
229- handler .logError ("Only one report found. Cannot compare without at least two reports ." );
230+ handler .logError ("Both 'from' and 'to' dates must be specified when using a specific check ." );
230231 return false ;
231232 }
232233 return true ;
@@ -343,7 +344,7 @@ private void compareReports(Context context) {
343344 e .send ();
344345 handler .logInfo ("Report sent to: " + String .join (", " , emails ));
345346 } catch (IOException | MessagingException e ) {
346- log . error ("Error sending email:" , e );
347+ handler . logError ("Error sending email: " + e . getMessage () );
347348 }
348349 }
349350
0 commit comments