chibenwa commented on code in PR #1561:
URL: https://github.com/apache/james-project/pull/1561#discussion_r1233326161
##########
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSubmissionSetMethod.scala:
##########
@@ -319,23 +365,23 @@ class EmailSubmissionSetMethod @Inject()(serializer:
EmailSubmissionSetSerialize
val cc: List[Address] =
Option(mimeMessage.getRecipients(RecipientType.CC)).toList.flatten
val bcc: List[Address] =
Option(mimeMessage.getRecipients(RecipientType.BCC)).toList.flatten
for {
- mailFrom <- Option(mimeMessage.getFrom).toList.flatten
+ mailFrom <- Try(Option(mimeMessage.getFrom).toList.flatten
.headOption
.map(_.asInstanceOf[InternetAddress].getAddress)
.map(s => Try(new MailAddress(s)))
.getOrElse(Failure(new IllegalArgumentException("Implicit envelope
detection requires a from field")))
- .map(EmailSubmissionAddress)
- rcptTo <- (to ++ cc ++ bcc)
+ .get).map(EmailSubmissionAddress(_))
+ rcptTo <- Try((to ++ cc ++ bcc)
.map(_.asInstanceOf[InternetAddress].getAddress)
.map(s => Try(new MailAddress(s)))
- .sequence
+ .map(s => EmailSubmissionAddress(s.get)))
Review Comment:
Idem that's a very suspicious .get to me!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]