DomGarguilo commented on code in PR #5893:
URL: https://github.com/apache/accumulo/pull/5893#discussion_r2363942192


##########
core/src/main/java/org/apache/accumulo/core/data/ResourceGroupId.java:
##########
@@ -43,16 +43,23 @@ public class ResourceGroupId extends 
AbstractId<ResourceGroupId> {
 
   private ResourceGroupId(String canonical) {
     super(canonical);
-    if (!GROUP_NAME_PATTERN.matcher(canonical).matches()) {
-      throw new IllegalArgumentException(
-          "Group name: " + canonical + " contains invalid characters");
+    validateGroupName(canonical);
+  }
+
+  /**
+   * @throws IllegalArgumentException if the group name is invalid
+   */
+  public static void validateGroupName(String groupName) {
+    if (!GROUP_NAME_PATTERN.matcher(groupName).matches()) {
+      throw new IllegalArgumentException("Group name '" + groupName
+          + "' is invalid. Valid names must match the pattern: " + 
GROUP_NAME_PATTERN.pattern());

Review Comment:
   In the current changes we swapped GROUP_NAME_PATTERN from public to private 
and instead created a new public method that uses GROUP_NAME_PATTERN 
internally. I feel like its its a slight improvement to have a public method to 
validate compared to a public `Pattern` object. Maybe its best to have neither 
public tough which I think is your point here, @ctubbsii 



-- 
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]

Reply via email to