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



##########
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:
       Hi @azotcsit when you split consecutive separators are considered a 
single one and are not returned as splits. So  the string `func[]` is actually 
split as the array `["func"]` meaning a single element array hence we need to 
keep that logic. Makes sense?




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