You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/09/07 14:45:56 UTC

[1/2] activemq-artemis git commit: ARTEMIS-1403 - Fix wildcard matching to always respect delimiters

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 7f9545f4f -> 08839d299


ARTEMIS-1403 - Fix wildcard matching to always respect delimiters

The regular expressions for wildcard matching now properly respects the last
delimiter in a pattern and will not match a pattern missing the
delimiter by mistake


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/983ec7eb
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/983ec7eb
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/983ec7eb

Branch: refs/heads/master
Commit: 983ec7eb888a8bacacb11156d90653b3006f4e44
Parents: 7f9545f
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Authored: Thu Sep 7 07:57:38 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Sep 7 10:45:50 2017 -0400

----------------------------------------------------------------------
 .../org/apache/activemq/artemis/core/settings/impl/Match.java    | 4 +++-
 .../apache/activemq/artemis/core/settings/RepositoryTest.java    | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/983ec7eb/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/Match.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/Match.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/Match.java
index 940dff3..b149b2b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/Match.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/Match.java
@@ -35,6 +35,8 @@ public class Match<T> {
 
    private static final String WILDCARD_REPLACEMENT = ".*";
 
+   private static final String WILDCARD_CHILD_REPLACEMENT = "(\\..+)*";
+
    private static final String DOT = ".";
 
    private static final String DOT_REPLACEMENT = "\\.";
@@ -59,7 +61,7 @@ public class Match<T> {
          actMatch = actMatch.replace(Match.WORD_WILDCARD, Match.WORD_WILDCARD_REPLACEMENT);
 
          // this one has to be done by last as we are using .* and it could be replaced wrongly
-         actMatch = actMatch.replace(Match.WILDCARD, Match.WILDCARD_REPLACEMENT);
+         actMatch = actMatch.replace(Match.WILDCARD, Match.WILDCARD_CHILD_REPLACEMENT);
       }
       pattern = Pattern.compile(actMatch);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/983ec7eb/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java
index ed272c4..35f84ae 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java
@@ -59,6 +59,9 @@ public class RepositoryTest extends ActiveMQTestBase {
       Assert.assertEquals("ab#", repo.getMatch("a.b.c"));
       Assert.assertEquals("abd#", repo.getMatch("a.b.d.lll"));
       Assert.assertEquals("root", repo.getMatch("z.z.z.z.z"));
+      Assert.assertEquals("root", repo.getMatch("a.babc"));
+      Assert.assertEquals("ab#", repo.getMatch("a.b.dabc"));
+      Assert.assertEquals("abd#", repo.getMatch("a.b.d"));
    }
 
    @Test


[2/2] activemq-artemis git commit: This closes #1519

Posted by cl...@apache.org.
This closes #1519


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/08839d29
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/08839d29
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/08839d29

Branch: refs/heads/master
Commit: 08839d2996c3ae72d80560f09612d9463cb676ad
Parents: 7f9545f 983ec7e
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Sep 7 10:45:51 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Sep 7 10:45:51 2017 -0400

----------------------------------------------------------------------
 .../org/apache/activemq/artemis/core/settings/impl/Match.java    | 4 +++-
 .../apache/activemq/artemis/core/settings/RepositoryTest.java    | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------