gemmellr commented on code in PR #6038:
URL: https://github.com/apache/activemq-artemis/pull/6038#discussion_r2533815305
##########
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:
Since the value passed in the only usage of this method must be a fixed
String with single character, should the param here perhaps just be made a
`char` (presumably need another static constant if still needing a string, but
they can inter-reference) and then none of these checks or the conversion or
related documentation are needed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact