ctubbsii commented on a change in pull request #1971:
URL: https://github.com/apache/accumulo/pull/1971#discussion_r595297920
##########
File path:
core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
##########
@@ -96,6 +96,7 @@
private ClientInfo info;
private String instanceId;
private final ZooCache zooCache;
+ private static final String VALID_NAME_REGEX =
"^(\\w{1,1024}\\.)?(\\w{1,1024})$";
Review comment:
I prefer `[.]` over `\\.` in Java regex expressions, because it's fewer
backslash escapes, and is the same no matter how it is quoted in a string/java
string/regex parser parameter/command-line.
```suggestion
private static final String VALID_NAME_REGEX =
"^(\\w{1,1024}[.])?(\\w{1,1024})$";
```
Although I haven't yet had a chance to look over this whole PR, I think
`Tables.java` is probably a better place for this constant, since the constant
is scoped to table names. This is where the current regex for valid names is.
However, that current one doesn't quite validate properly, because it doesn't
validate fully-qualified (namespace + table) table names, or enforce the length
constraint. A regex in `Tables.java` and a similar one in `Namespaces.java` (to
validate just namespace names) probably make sense.
(https://github.com/apache/accumulo/blob/main/core/src/main/java/org/apache/accumulo/core/clientImpl/Tables.java#L48)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]