kevinrr888 commented on code in PR #5861:
URL: https://github.com/apache/accumulo/pull/5861#discussion_r2325237015


##########
core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java:
##########
@@ -484,44 +485,66 @@ private ValidFateConfig(Set<Fate.FateOperation> 
allFateOps, String name) {
 
     @Override
     public boolean test(String s) {
-      final Set<Fate.FateOperation> seenFateOps;
+      final Set<Fate.FateOperation> seenFateOps = new HashSet<>();
+      final int maxPoolNameLen = 64;
 
       try {
         final var json = JsonParser.parseString(s).getAsJsonObject();
-        seenFateOps = new HashSet<>();
 
         for (var entry : json.entrySet()) {
-          var key = entry.getKey();
-          var val = entry.getValue().getAsInt();
-          if (val <= 0) {
+          var poolName = entry.getKey();
+
+          if (poolName.length() > maxPoolNameLen) {
+            log.warn(
+                "Unexpected property value {} for {}. Configured name {} is 
too long (> {} characters). Property was unchanged",
+                s, name, poolName, maxPoolNameLen);
+            return false;
+          }
+
+          var poolConfigSet = entry.getValue().getAsJsonObject().entrySet();
+          if (poolConfigSet.size() != 1) {
+            log.warn(
+                "Unexpected property value {} for {}. Expected one entry for 
{} but saw {}. Property was unchanged",
+                s, name, poolName, poolConfigSet.size());
+            return false;
+          }
+
+          var poolConfig = poolConfigSet.iterator().next();
+
+          var poolSize = poolConfig.getValue().getAsInt();
+          if (poolSize <= 0) {
             log.warn(
-                "Invalid entry {} in {}. Must be a valid thread pool size. 
Property was unchanged.",
-                entry, name);
+                "Unexpected property value {} for {}. Must be a valid thread 
pool size (>0), saw {}. Property was unchanged",
+                s, name, poolSize);
             return false;
           }
-          var fateOpsStrArr = key.split(",");
+
+          var fateOpsStrArr = poolConfig.getKey().split(",");
           for (String fateOpStr : fateOpsStrArr) {
             Fate.FateOperation fateOp = Fate.FateOperation.valueOf(fateOpStr);

Review Comment:
   Same comment about already being in a try-catch



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