You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "netudima (via GitHub)" <gi...@apache.org> on 2025/08/09 16:10:10 UTC

Re: [PR] CASSANDRA-20389 prevent too long table names not fitting file names [cassandra]

netudima commented on code in PR #4038:
URL: https://github.com/apache/cassandra/pull/4038#discussion_r2264839040


##########
src/java/org/apache/cassandra/schema/KeyspaceMetadata.java:
##########
@@ -62,6 +64,32 @@ public final class KeyspaceMetadata implements SchemaElement
 {
     public static final Serializer serializer = new Serializer();
 
+    /**
+     * Validates the keyspace name for valid characters and correct length.
+     * Throws an exception if it's invalid.
+     *
+     * @param keyspaceName The name of the keyspace to validate
+     * @param ex           The exception class to throw if validation fails
+     */
+    public static <T extends RequestValidationException> void validateKeyspaceName(String keyspaceName, Class<T> ex)
+    {
+        try
+        {
+            if (!SchemaConstants.isValidCharsName(keyspaceName))
+                throw ex.getConstructor(String.class)
+                        .newInstance(format("Table name must not be empty or not contain non-alphanumeric-underscore characters (got \"%s\")",

Review Comment:
   the method is to validate a keyspace name but the exception message it produces says: "Table name .."



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org