osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] activemq-artemis issue #2113: [ARTEMIS-1890] Any-word wildcard fix


Github user jostbg commented on the issue:

    https://github.com/apache/activemq-artemis/pull/2113
  
    Interestingly the regex-based wildcard matcher implemented in [org.apache.activemq.artemis.core.settings.impl.Match.java](https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/Match.java) used by [HierarchicalObjectRepository](https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java) behaves like the change I suggest with my PR and actually matches `a.#.c` and `a.c` as expected according the documentation.
    
    ```java
    import org.apache.activemq.artemis.core.config.WildcardConfiguration;
    import org.apache.activemq.artemis.core.settings.impl.Match;
    import org.junit.*;
    import java.util.regex.Pattern;
    
    public class MatchTest {
    
       @Test
       public void testAnyWordWildcard() {
          Pattern p = new Match<String>("a.#.c", null, new WildcardConfiguration()).getPattern();
          Assert.assertTrue(p.matcher("a.c").matches());
          Assert.assertTrue(p.matcher("a.b.d.c").matches());
          Assert.assertFalse(p.matcher("a.c.d").matches());
       }
    }
    ```
    
    I guess this means specifying a filter expression in AddressSettings currently can match different addresses than specifying the same expression in a subscription.


---