diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/service/NihmsReceiveMailService.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/service/NihmsReceiveMailService.java index c0c644e1..062fb51d 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/service/NihmsReceiveMailService.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/service/NihmsReceiveMailService.java @@ -77,18 +77,18 @@ public NihmsReceiveMailService(PassClient passClient, } private final List depositFailurePatterns = List.of( - Pattern.compile("package id=(.*) failed because.*", Pattern.CASE_INSENSITIVE), - Pattern.compile("package id=(.*) was not submitted.*", Pattern.CASE_INSENSITIVE), - Pattern.compile("package id=(.*) is corrupt.*", Pattern.CASE_INSENSITIVE), - Pattern.compile("package id=(.*) was already used for Manuscript.*submission not created.*", + Pattern.compile("package id=(\\S{1,75}) failed because.*", Pattern.CASE_INSENSITIVE), + Pattern.compile("package id=(\\S{1,75}) was not submitted.*", Pattern.CASE_INSENSITIVE), + Pattern.compile("package id=(\\S{1,75}) is corrupt.*", Pattern.CASE_INSENSITIVE), + Pattern.compile("package id=(\\S{1,75}) was already used for Manuscript.*submission not created.*", Pattern.CASE_INSENSITIVE), - Pattern.compile("package id=(.*) for Manuscript.*submitted with the following problem.*", + Pattern.compile("package id=(\\S{1,75}) for Manuscript.*submitted with the following problem.*", Pattern.CASE_INSENSITIVE), - Pattern.compile("package id=(.*) contains unrecognized.*", Pattern.CASE_INSENSITIVE) + Pattern.compile("package id=(\\S{1,75}) contains unrecognized.*", Pattern.CASE_INSENSITIVE) ); private final Pattern depositSuccessPattern = - Pattern.compile("package id=(.*) for Manuscript ID (.*) was submitted successfully.*", + Pattern.compile("package id=(\\S{1,75}) for Manuscript ID (\\S{1,25}) was submitted successfully.*", Pattern.CASE_INSENSITIVE); public void handleReceivedMail(MimeMessage receivedMessage) { diff --git a/pass-nihms-loader/nihms-data-harvest/src/main/java/org/eclipse/pass/loader/nihms/NihmsHarvesterCLIRunner.java b/pass-nihms-loader/nihms-data-harvest/src/main/java/org/eclipse/pass/loader/nihms/NihmsHarvesterCLIRunner.java index fa2b5af9..616a417c 100644 --- a/pass-nihms-loader/nihms-data-harvest/src/main/java/org/eclipse/pass/loader/nihms/NihmsHarvesterCLIRunner.java +++ b/pass-nihms-loader/nihms-data-harvest/src/main/java/org/eclipse/pass/loader/nihms/NihmsHarvesterCLIRunner.java @@ -23,6 +23,8 @@ import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.Option; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @@ -34,6 +36,8 @@ @Component public class NihmsHarvesterCLIRunner implements CommandLineRunner { + private static final Logger LOG = LoggerFactory.getLogger(NihmsHarvesterCLIRunner.class); + /** * Request for help/usage documentation */ @@ -96,7 +100,6 @@ public void run(String... args) { /* Handle general options such as help, version */ if (this.help) { parser.printUsage(System.err); - System.err.println(); System.exit(0); } @@ -121,16 +124,10 @@ public void run(String... args) { nihmsHarvester.harvest(statusesToProcess, harvestPeriodMonths); } catch (CmdLineException e) { - /** - * This is an error in command line args, just print out usage data - * and description of the error. - */ - System.err.println(e.getMessage()); parser.printUsage(System.err); System.exit(1); } catch (Exception e) { - e.printStackTrace(); - System.err.println(e.getMessage()); + LOG.error("Error running Nihms Harvester", e); System.exit(1); } } diff --git a/pass-nihms-loader/nihms-data-transform-load/src/main/java/org/eclipse/pass/loader/nihms/NihmsTransformLoadCLIRunner.java b/pass-nihms-loader/nihms-data-transform-load/src/main/java/org/eclipse/pass/loader/nihms/NihmsTransformLoadCLIRunner.java index ef242c38..7ea2eb67 100644 --- a/pass-nihms-loader/nihms-data-transform-load/src/main/java/org/eclipse/pass/loader/nihms/NihmsTransformLoadCLIRunner.java +++ b/pass-nihms-loader/nihms-data-transform-load/src/main/java/org/eclipse/pass/loader/nihms/NihmsTransformLoadCLIRunner.java @@ -22,6 +22,8 @@ import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.Option; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @@ -30,6 +32,9 @@ */ @Component public class NihmsTransformLoadCLIRunner implements CommandLineRunner { + + private static final Logger LOG = LoggerFactory.getLogger(NihmsTransformLoadCLIRunner.class); + /** * Request for help/usage documentation */ @@ -77,7 +82,6 @@ public void run(String... args) { /* Handle general options such as help, version */ if (this.help) { parser.printUsage(System.err); - System.err.println(); System.exit(0); } @@ -97,20 +101,11 @@ public void run(String... args) { nihmsTransformLoadService.transformAndLoadFiles(statusesToProcess); } catch (CmdLineException e) { - /** - * This is an error in command line args, just print out usage data - * and description of the error. - */ - System.err.println(e.getMessage()); parser.printUsage(System.err); - System.err.println(); System.exit(1); - } catch (Exception e) { - e.printStackTrace(); - System.err.println(e.getMessage()); + LOG.error("Error running Nihms Transform and Load", e); System.exit(1); - } } }