[
https://issues.apache.org/jira/browse/ARTEMIS-5739?focusedWorklogId=992042&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-992042
]
ASF GitHub Bot logged work on ARTEMIS-5739:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 17/Nov/25 14:14
Start Date: 17/Nov/25 14:14
Worklog Time Spent: 10m
Work Description: jbertram commented on code in PR #6038:
URL: https://github.com/apache/activemq-artemis/pull/6038#discussion_r2534241993
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/config/WildcardConfiguration.java:
##########
@@ -240,4 +240,22 @@ private void replaceChar(StringBuilder result, char
replace, char replacement) {
}
}
}
+
+ /**
+ * Checks if the given input string represents a valid character that
matches one of the defined wildcard characters.
+ * <p>
+ * The input string must contain exactly one character. If the input is
null, empty, or contains more than one
+ * character, an IllegalArgumentException is thrown.
+ *
+ * @param input the input string to check; it must contain exactly one
character
+ * @return true if the single character in the input matches one of the
wildcard characters, otherwise false
+ * @throws IllegalArgumentException if the input is null, empty, or
contains more than one character
+ */
+ public boolean contains(String input) {
+ if (input == null || input.isEmpty() || input.length() > 1) {
+ throw new IllegalArgumentException();
+ }
+ char inputChar = input.charAt(0);
Review Comment:
I considered that originally but decided against it for some reason(s) that
I can no longer recall. I'm using `char` now and it's much nicer.
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/config/WildcardConfiguration.java:
##########
@@ -240,4 +240,22 @@ private void replaceChar(StringBuilder result, char
replace, char replacement) {
}
}
}
+
+ /**
+ * Checks if the given input string represents a valid character that
matches one of the defined wildcard characters.
+ * <p>
+ * The input string must contain exactly one character. If the input is
null, empty, or contains more than one
+ * character, an IllegalArgumentException is thrown.
+ *
+ * @param input the input string to check; it must contain exactly one
character
+ * @return true if the single character in the input matches one of the
wildcard characters, otherwise false
+ * @throws IllegalArgumentException if the input is null, empty, or
contains more than one character
+ */
+ public boolean contains(String input) {
+ if (input == null || input.isEmpty() || input.length() > 1) {
+ throw new IllegalArgumentException();
+ }
+ char inputChar = input.charAt(0);
Review Comment:
I considered that originally but decided against it for some reason(s) that
I can no longer recall. I'm using `char` now, and it's much nicer.
Issue Time Tracking
-------------------
Worklog Id: (was: 992042)
Time Spent: 50m (was: 40m)
> 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: 50m
> 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