gemmellr commented on code in PR #5487:
URL: https://github.com/apache/activemq-artemis/pull/5487#discussion_r1952392953


##########
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/RandomUtil.java:
##########
@@ -31,17 +31,56 @@ public static Random getRandom() {
       return random;
    }
 
+   private static String letters = "abcdefghijklmnopqrstuvwxyz";
+
+   private static String digits = "0123456789";
+
+   private static String randomBase = letters + letters.toUpperCase() + digits;
+
+   /**
+    * Utility method to build a {@code String} filled with random 
alpha-numeric characters. The {@code String} will
+    * contain characters from the following:
+    * <ul>
+    *    <li>abcdefghijklmnopqrstuvwxyz</li>
+    *    <li>ABCDEFGHIJKLMNOPQRSTUVWXYZ</li>
+    *    <li>0123456789</li>
+    * </ul>
+    * @param length how long the returned {@code String} should be
+    * @return a {@code String} of random alpha-numeric characters
+    */
+   public static String randomAlphaNumericString(int length) {
+      StringBuilder result = new StringBuilder(length);
+      for (int i = 0; i < length; i++) {
+         result.append(randomBase.charAt(randomInterval(0, 
randomBase.length())));
+      }
+      return result.toString();
+   }
 
-   public static String randomString() {

Review Comment:
   Fair enough. I totally agree its a grey area at least. Hopefully it _doesnt_ 
break anything too annoying. Personally I don't think this rename really 
clarifies much, given the typical use and impl of such a no-arg method, so for 
me any breakage would entirely outweigh the case for even changing it to begin 
with.
   
   A test-only variant would actually need to go in `artemis-unit-test-support` 
now that I think about it, if used by tests for any modules that are outside 
the tests tree (none of which are deployed, so cant be used by those which 
are). I don't consider modules using the test support modules as a bad thing 
either way.
   
   We can consider this in future either way. Will resolve.



-- 
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: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to