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


##########
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();

Review Comment:
   The entire validation is in a try with a catch:
   ```
         } catch (Exception e) {
           log.warn("Unexpected property value {} for {}. Exception occurred. 
Property was unchanged",
               s, name, e);
           return false;
         }
   ```



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