Skip to content

Commit

Permalink
Use String.replaceAll
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoet-jh committed Dec 19, 2024
1 parent aacdd12 commit 63d80d1
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 63d80d1

Please sign in to comment.