netudima commented on code in PR #4038: URL: https://github.com/apache/cassandra/pull/4038#discussion_r2264839552
########## 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) Review Comment: what is about using a lambda here to create Exception instance instead of reflection? If a signature for one of used exception classes change the current logic will detect it only in runtime, with a lambda it will be found during a compilation. -- 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-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org