[ 
https://issues.apache.org/jira/browse/ARTEMIS-5739?focusedWorklogId=991808&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-991808
 ]

ASF GitHub Bot logged work on ARTEMIS-5739:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Nov/25 20:05
            Start Date: 14/Nov/25 20:05
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on code in PR #6038:
URL: https://github.com/apache/activemq-artemis/pull/6038#discussion_r2528792760


##########
docs/user-manual/wildcard-syntax.adoc:
##########
@@ -72,3 +72,13 @@ For that, the `<wildcard-addresses>` configuration tag is 
used.
 ----
 
 The example above shows the default configuration.
+
+[NOTE]
+====
+It is technically _possible_ to use `$` as a custom wildcard character, but it 
is not recommended for two main reasons:
+
+. The default value of `internal-naming-prefix` is `$.activemq.internal.` 
which includes a `$` character.
+While this value can be changed, doing so may cause problems if, for example, 
you have already created a cluster while the default value was in use.
+In this case the broker will have already created store-and-forward resources 
that will have to be renamed manually.
+. The MQTT protocol uses `$` for certain bits of functionality (e.g. shared 
subscriptions) and this cannot be changed so MQTT functionality would need to 
be completely avoided.

Review Comment:
   Noted.



##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/Match.java:
##########
@@ -65,14 +65,16 @@ public Match(final String match, final T value, final 
WildcardConfiguration wild
          // this is to match with what's documented
          actMatch = 
actMatch.replace(wildcardConfiguration.getDelimiterString() + 
wildcardConfiguration.getAnyWordsString(), 
wildcardConfiguration.getAnyWordsString());
          actMatch = actMatch.replace(Match.DOT, Match.DOT_REPLACEMENT);
-         actMatch = actMatch.replace(Match.DOLLAR, Match.DOLLAR_REPLACEMENT);
+         if (!wildcardConfiguration.contains(Match.DOLLAR)) {
+            actMatch = actMatch.replace(Match.DOLLAR, 
Match.DOLLAR_REPLACEMENT);
+         }
          actMatch = 
actMatch.replace(wildcardConfiguration.getSingleWordString(), 
String.format(WORD_WILDCARD_REPLACEMENT_FORMAT, 
Pattern.quote(wildcardConfiguration.getDelimiterString())));
 
          // this one has to be done by last as we are using .* and it could be 
replaced wrongly if delimiter is '.'
          actMatch = 
actMatch.replace(wildcardConfiguration.getAnyWordsString(), 
String.format(WILDCARD_CHILD_REPLACEMENT_FORMAT, 
Pattern.quote(wildcardConfiguration.getDelimiterString())));
       }
       // we need to anchor with eot to ensure we have a full match
-      pattern = Pattern.compile(actMatch + "$");
+      pattern = Pattern.compile(actMatch + DOLLAR);

Review Comment:
   Fixed.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 991808)
    Time Spent: 0.5h  (was: 20m)

> Can't use $ for wildcard any-words
> ----------------------------------
>
>                 Key: ARTEMIS-5739
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5739
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In previous versions of Artemis it was possible to use {{$}} for 
> {{any-words}}, e.g.:
> {code:xml}
> <wildcard-addresses>
>    <routing-enabled>true</routing-enabled>
>    <delimiter>.</delimiter>
>    <any-words>$</any-words>
>    <single-word>*</single-word>
> </wildcard-addresses>
> {code}
> However, that was broken in the commits for ARTEMIS-4754. Now if {{$}} is 
> used for {{any-words}} and in an address-setting or security-setting 
> {{match}} this exception is thrown on startup:
> {noformat}
> AMQ224000: Failure in initialisation
> java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 25
> activemq\.management\(\Q.\E.+)*$
>                          ^
>       at java.base/java.util.regex.Pattern.error(Pattern.java:2028)
>       at java.base/java.util.regex.Pattern.compile(Pattern.java:1787)
>       at java.base/java.util.regex.Pattern.<init>(Pattern.java:1430)
>       at java.base/java.util.regex.Pattern.compile(Pattern.java:1069)
>       at 
> org.apache.activemq.artemis.core.settings.impl.Match.<init>(Match.java:75)
>       at 
> org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository.addMatch(HierarchicalObjectRepository.java:216)
>       at 
> org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository.addMatch(HierarchicalObjectRepository.java:189)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.deployAddressSettingsFromConfiguration(ActiveMQServerImpl.java:3820)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.initialisePart1(ActiveMQServerImpl.java:3357)
>       at 
> org.apache.activemq.artemis.core.server.impl.PrimaryOnlyActivation.run(PrimaryOnlyActivation.java:70)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.internalStart(ActiveMQServerImpl.java:754)
>       at 
> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:644)
>       at 
> org.apache.activemq.artemis.integration.FileBroker.start(FileBroker.java:67)
>       at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:132)
>       at 
> org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:222)
>       at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:170)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
>       at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:569)
>       at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:149)
>       at 
> org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:61){noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to