azotcsit commented on a change in pull request #1211:
URL: https://github.com/apache/cassandra/pull/1211#discussion_r714539470



##########
File path: src/java/org/apache/cassandra/auth/FunctionResource.java
##########
@@ -176,8 +177,10 @@ public static FunctionResource fromName(String name)
         if (parts.length == 2)
             return keyspace(parts[1]);
 
+        if (!name.matches("^.+\\[.*\\]$"))
+            throw new IllegalArgumentException(String.format("%s is not a 
valid function resource name. It must end with \"[]\"", name));
         String[] nameAndArgs = StringUtils.split(parts[2], "[|]");
-        return function(parts[1], nameAndArgs[0], 
argsListFromString(nameAndArgs[1]));
+        return function(parts[1], nameAndArgs[0], nameAndArgs.length > 1 ? 
argsListFromString(nameAndArgs[1]) : Collections.emptyList());

Review comment:
       I'm not sure this check make sense now because we added the same logical 
check by the pattern match. It guarantees that we won't receive the name 
without square brackets, so `nameAndArgs.length > 1 ` is always true.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to