Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
master
-
None
Description
What
14:18:14.713 [ERROR] o.a.j.t.m.r.d.MailDelivrer - Generic exception = permanent failure: null java.lang.NullPointerException: null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:889) at com.google.common.collect.ImmutableSet$Builder.add(ImmutableSet.java:517) at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.Collections$2.tryAdvance(Collections.java:4747) at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4755) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at org.apache.james.transport.mailets.remote.delivery.InternetAddressConverter.convert(InternetAddressConverter.java:36) at org.apache.james.transport.mailets.remote.delivery.MailDelivrer.tryDeliver(MailDelivrer.java:118) at org.apache.james.transport.mailets.remote.delivery.MailDelivrer.deliver(MailDelivrer.java:87) at org.apache.james.transport.mailets.remote.delivery.DeliveryRunnable.attemptDelivery(DeliveryRunnable.java:146) at org.apache.james.transport.mailets.remote.delivery.DeliveryRunnable.lambda$processMail$3(DeliveryRunnable.java:123) at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:57) at reactor.core.publisher.Mono.subscribe(Mono.java:4400) at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.run(MonoSubscribeOn.java:126) at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84) at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)
Why ?
Due to too relaxed parsing rules in MailAdress we end up accepting invalid email addresses as part of incoming SMTP addresses.
Example:
a..b@domain.com a@#b.com a\.@b.com
However javax.mail is not able to work with such addresses.
This is problematic when:
- We compose a message based on SMTP envelope (eg: bounces)
- We rely on javax mail when we send emails to remote SMTP servers (remote delivery)
Proposed solution
Stricter parsing in MailAddress POJO. Reject those invalid addresses that we don't know how to handle.
Attachments
Issue Links
- links to