This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new 9844d45  JAMES-1444 Using HasMailAttributeWithValueRegex matcher 
causes NPE during startup when JMX is enabled (#633)
9844d45 is described below

commit 9844d45e1dbbb5c8545ae1c775803288be8e8f1c
Author: Benoit TELLIER <[email protected]>
AuthorDate: Wed Sep 8 10:08:10 2021 +0700

    JAMES-1444 Using HasMailAttributeWithValueRegex matcher causes NPE during 
startup when JMX is enabled (#633)
---
 .../james/transport/matchers/HasMailAttributeWithValueRegex.java | 1 +
 .../transport/matchers/HasMailAttributeWithValueRegexTest.java   | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git 
a/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegex.java
 
b/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegex.java
index 3a56f17..6d19242 100644
--- 
a/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegex.java
+++ 
b/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegex.java
@@ -73,6 +73,7 @@ public class HasMailAttributeWithValueRegex extends 
GenericMatcher {
         } else {
             throw new MessagingException("malformed condition for 
HasMailAttributeWithValueRegex. must be of the form: attr,regex");
         }
+        super.init(conf);
     }
 
     /**
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
index c8fb3c6..7fc3bf1 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
@@ -66,6 +66,15 @@ public class HasMailAttributeWithValueRegexTest extends 
AbstractHasMailAttribute
     }
 
     @Test
+    public void getMatcherConfigShouldNotReturnNull() throws 
MessagingException {
+        init();
+        setRegex(".*");
+        setupAll();
+
+        assertThat(matcher.getMatcherConfig()).isNotNull();
+    }
+
+    @Test
     void testHeaderIsNotMatched() throws MessagingException {
         setRegex("\\d");
         setupAll();

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to