linagora / james-project

Mirror of Apache James Project
Apache License 2.0
72 stars 62 forks source link

Combining composite matchers #5318

Open chibenwa opened 1 day ago

chibenwa commented 1 day ago
+            <matcher name="relay-allowed" match="org.apache.james.mailetcontainer.impl.matchers.Or">
+                <matcher match="SMTPAuthSuccessful"/>
+                <matcher match="SMTPIsAuthNetwork"/>
+                <matcher match="SentByMailet"/>
+                <matcher match="org.apache.james.jmap.mailet.SentByJmap"/>
+            </matcher>
+            <matcher name="should-check-spam" match="org.apache.james.mailetcontainer.impl.matchers.Not">
+                <matcher match="relay-allowed"/>
+            </matcher>

yields

Fatal error while starting James","context":"default","exception":"jakarta.mail.MessagingException: Can not load matcher relay-allowed\n\tat org.apache.james.utils.GuiceMatcherLoader.getMatcher(GuiceMatcherLoader.java:50)\n\tat org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor.loadCompositeMatchers(AbstractStateMailetProcessor.java:235)\n\tat org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor.loadCompositeMatchers(AbstractStateMailetProcessor.java:239)\n\tat org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor.parseConfiguration(AbstractStateMailetProcessor.java:276)\n\tat org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor.init(AbstractStateMailetProcessor.java:116)\n\tat org.apache.james.mailetcontainer.impl.MailetProcessorImpl.init(MailetProcessorImpl.java:192)\n\tat org.apache.james.mailetcontainer.impl.CompositeProcessorImpl.createMailProcessor(CompositeProcessorImpl.java:72)\n\tat org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.init(AbstractStateCompositeProcessor.java:171)\n\tat org.apache.james.mailetcontainer.impl.CompositeProcessorImpl.init(CompositeProcessorImpl.java:60)\n\tat org.apache.james.modules.server.MailetContainerModule$MailetModuleInitializationOperation.configureProcessors(MailetContainerModule.java:190)\n\tat org.apache.james.modules.server.MailetContainerModule$MailetModuleInitializationOperation.initModule(MailetContainerModule.java:182)\n\tat com.github.fge.lambdas.consumers.ConsumerChainer.lambda$sneakyThrow$9(ConsumerChainer.java:73)\n\tat java.base/java.util.stream.ReferencePipeline$15$1.accept(Unknown Source)\n\tat java.base/java.util.stream.DistinctOps$1$2.accept(Unknown Source)\n\tat java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)\n\tat java.base/java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Unknown Source)\n\tat java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Unknown Source)\n\tat java.base/java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)\n\tat java.base/java.util.stream.ReferencePipeline$7$1FlatMap.accept(Unknown Source)\n\tat java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)\n\tat java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)\n\tat java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)\n\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)\n\tat java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)\n\tat java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)\n\tat java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)\n\tat java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)\n\tat java.base/java.util.stream.ReferencePipeline$7$1FlatMap.accept(Unknown Source)\n\tat java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)\n\tat java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)\n\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)\n\tat java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)\n\tat java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)\n\tat java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)\n\tat org.apache.james.utils.InitializationOperations.processStartables(InitializationOperations.java:51)\n\tat org.apache.james.utils.InitializationOperations.initModules(InitializationOperations.java:41)\n\tat org.apache.james.GuiceJamesServer.start(GuiceJamesServer.java:96)\n\tat org.apache.james.JamesServerMain.main(JamesServerMain.java:30)\n\tat com.linagora.tmail.james.app.DistributedServer.main(DistributedServer.java:322)\nCaused by: java.lang.ClassNotFoundException: relay-allowed\n\tat org.apache.james.utils.GuiceGenericLoader$InvocationPerformer.locateClass(GuiceGenericLoader.java:66)\n\tat org.apache.james.utils.GuiceGenericLoader$InvocationPerformer.instantiate(GuiceGenericLoader.java:56)\n\tat org.apache.james.utils.GuiceMatcherLoader.getMatcher(GuiceMatcherLoader.java:46)\n\t... 38 common frames omitted\n

Expectation: chaining composite matchers should be doable

quantranhong1999 commented 11 hours ago

https://github.com/apache/james-project/pull/2494