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


##########
server/base/src/main/java/org/apache/accumulo/server/conf/cluster/ClusterConfigParser.java:
##########
@@ -147,11 +141,32 @@ private static List<String> parseGroup(Map<String,String> 
config, String prefix)
         throw new IllegalArgumentException("Malformed configuration, has too 
many levels: " + k);
       }
     }).sorted().distinct().collect(Collectors.toList());
-    validateGroupNames(groups);
+    ResourceGroupId.validateGroupNames(groups);
     return groups;
   }
 
-  public static void outputShellVariables(Map<String,String> config, 
PrintStream out) {
+  private static void validateConfiguredGroups(final ServerContext ctx, final 
Set<String> zkGroups,
+      final List<String> configuredGroups, boolean createMissingRG) {
+    for (String cg : configuredGroups) {
+      if (!zkGroups.contains(cg)) {
+        if (createMissingRG) {
+          try {
+            ResourceGroupPropKey.of(ResourceGroupId.of(cg))
+                .createZNode(ctx.getZooSession().asReaderWriter());

Review Comment:
   Fixed in bd50934



##########
core/src/main/java/org/apache/accumulo/core/data/ResourceGroupId.java:
##########
@@ -18,15 +18,34 @@
  */
 package org.apache.accumulo.core.data;
 
+import java.util.List;
+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> {
 
+  private static final Pattern GROUP_NAME_PATTERN = 
Pattern.compile("^[a-zA-Z]+(_?[a-zA-Z0-9])*$");
+
+  public static void validateGroupName(ResourceGroupId rgid) {
+    if (!GROUP_NAME_PATTERN.matcher(rgid.canonical()).matches()) {
+      throw new IllegalArgumentException(
+          "Group name: " + rgid.canonical() + " contains invalid characters");
+    }
+  }
+
+  public static void validateGroupNames(List<String> names) {
+    for (String name : names) {
+      if (!GROUP_NAME_PATTERN.matcher(name).matches()) {
+        throw new RuntimeException("Group name: " + name + " contains invalid 
characters");
+      }
+    }
+  }

Review Comment:
   Fixed in bd50934



-- 
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: notifications-unsubscr...@accumulo.apache.org

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

Reply via email to