From 63d80d11ea165bc1fa2f6cc444061fbf5e0c50c4 Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Thu, 19 Dec 2024 08:54:53 -0500 Subject: [PATCH] Use String.replaceAll --- .../deposit/service/NihmsReceiveMailService.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 0aeef643..c0c644e1 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 @@ -31,7 +31,6 @@ import jakarta.mail.internet.AddressException; import jakarta.mail.internet.InternetAddress; import jakarta.mail.internet.MimeMessage; -import org.apache.commons.lang3.StringUtils; import org.eclipse.pass.deposit.provider.nihms.NihmsAssembler; import org.eclipse.pass.support.client.PassClient; import org.eclipse.pass.support.client.PassClientSelector; @@ -94,21 +93,21 @@ public NihmsReceiveMailService(PassClient passClient, public void handleReceivedMail(MimeMessage receivedMessage) { try { - LOG.warn("Email received: " + receivedMessage.getSubject()); + LOG.warn("Email received: {}", receivedMessage.getSubject()); if (isEmailNotNihms(receivedMessage)) { return; } LOG.warn("Email is from Nihms"); String content = getHtmlText(receivedMessage); - String cleansedContent = StringUtils.normalizeSpace(content); - LOG.warn("Nihms Email content:" + cleansedContent); if (Objects.isNull(content)) { - LOG.error("No HTML content found in nihms email: " + receivedMessage.getSubject()); + LOG.error("No HTML content found in nihms email: {}", receivedMessage.getSubject()); return; } - Elements messageElements = getMessageElements(cleansedContent); + String loggingContent = content.replaceAll("[\n\r]", " "); + LOG.warn("Nihms Email content: {}", loggingContent); + Elements messageElements = getMessageElements(content); if (messageElements.isEmpty()) { - LOG.error("No messages found in nihms email: " + cleansedContent); + LOG.error("No messages found in nihms email: {}", loggingContent); return; } processMessages(messageElements);