ctubbsii commented on code in PR #5749:
URL: https://github.com/apache/accumulo/pull/5749#discussion_r2323897678


##########
core/src/main/java/org/apache/accumulo/core/data/ResourceGroupId.java:
##########
@@ -18,15 +18,18 @@
  */
 package org.apache.accumulo.core.data;
 
+import java.util.regex.Pattern;
+
 import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.conf.cluster.ClusterConfigParser;
 import org.apache.accumulo.core.util.cache.Caches;
 import org.apache.accumulo.core.util.cache.Caches.CacheName;
 
 import com.github.benmanes.caffeine.cache.Cache;
 
 public class ResourceGroupId extends AbstractId<ResourceGroupId> {
 
+  public static final Pattern GROUP_NAME_PATTERN = 
Pattern.compile("^[a-zA-Z]+(_?[a-zA-Z0-9])*$");

Review Comment:
   My version still restricts it to characters that are valid bash variable 
names. Bash allows variables that start with underscores, end with them, or 
have repeated ones. So, both your version and mine are more restrictive than 
bash, in that it requires a leading letter character. Yours is stricter than 
mine, but I think mine is easier to understand.... however, I forgot that Java 
requires double escaping backslashes in String literals, so I think it should 
actually be:
   
   ```suggestion
     public static final Pattern GROUP_NAME_PATTERN = 
Pattern.compile("^[a-zA-Z]\\w*$");
   ```



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