james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tellier Benoit (JIRA)" <server-...@james.apache.org>
Subject [jira] [Created] (JAMES-2557) NULL_SENDER throws an error in Dlp
Date Tue, 09 Oct 2018 04:44:00 GMT
Tellier Benoit created JAMES-2557:
-------------------------------------

             Summary: NULL_SENDER throws an error in Dlp
                 Key: JAMES-2557
                 URL: https://issues.apache.org/jira/browse/JAMES-2557
             Project: James Server
          Issue Type: Bug
          Components: Mailet Contributions
    Affects Versions: master, 3.1.0
            Reporter: Tellier Benoit
             Fix For: 3.2.0


Watching Kibana logs I got this recurring error:


{code:java}
 	Exception calling dlp.Dlp: NULL sender '<>' do not have domain part
java.lang.IllegalStateException: NULL sender '<>' do not have domain part
	at org.apache.james.core.MailAddress$1.getDomain(MailAddress.java:87)
	at org.apache.james.transport.matchers.dlp.Dlp.matchingRule(Dlp.java:76)
	at org.apache.james.transport.matchers.dlp.Dlp.lambda$findFirstMatchingRule$0(Dlp.java:72)
	at java.util.Optional.flatMap(Optional.java:241)
	at org.apache.james.transport.matchers.dlp.Dlp.findFirstMatchingRule(Dlp.java:72)
	at org.apache.james.transport.matchers.dlp.Dlp.match(Dlp.java:55)
	at org.apache.james.mailetcontainer.impl.camel.MatcherSplitter.split(MatcherSplitter.java:109)
	at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:481)
	at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:300)
	at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:273)
	at org.apache.camel.component.bean.AbstractBeanProcessor.process(AbstractBeanProcessor.java:187)
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
	at org.apache.camel.component.bean.AbstractBeanProcessor.process(AbstractBeanProcessor.java:70)
	at org.apache.camel.language.bean.BeanExpression.invokeBean(BeanExpression.java:200)
	at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:124)
	at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:135)
	at org.apache.camel.processor.Splitter.createProcessorExchangePairs(Splitter.java:127)
	at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:241)
	at org.apache.camel.processor.Splitter.process(Splitter.java:122)
	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
	at org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
	at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
	at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
	at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
	at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369)
	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506)
	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
	at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor.service(CamelMailetProcessor.java:68)
	at org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.service(AbstractStateCompositeProcessor.java:84)
	at org.apache.james.mailetcontainer.impl.JamesMailSpooler.lambda$run$0(JamesMailSpooler.java:163)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
{code}

It cames from the Dlp part (Dlp.java):


{code:java}
    private Optional<DLPConfigurationItem.Id> findFirstMatchingRule(Mail mail) {
        return Optional
                .ofNullable(mail.getSender())
                .flatMap(sender -> matchingRule(sender, mail));
    }

    private Optional<DLPConfigurationItem.Id> matchingRule(MailAddress address, Mail
mail) {
        return rulesLoader.load(address.getDomain()).match(mail);
    }
{code}

Since `mail.getSender()` returns a `NULL_SENDER` and not a `null` value, `matchingRule` is
executed, since it breaks the LSP, it breaks our code.

There are two solutions:

 * Strengthening `MailAddress`
 * Checking `MailAddress.isNullSender()`



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message