dtspence commented on code in PR #3549:
URL: https://github.com/apache/accumulo/pull/3549#discussion_r1245669310


##########
core/src/main/java/org/apache/accumulo/core/metadata/ValidationUtil.java:
##########
@@ -62,9 +62,12 @@ public static void validateRFileName(String fileName) {
 
   public static void validateFileName(String fileName) {
     Objects.requireNonNull(fileName);
-    if (!fileName.matches("[\\dA-Za-z._-]+")) {
-      throw new IllegalArgumentException(
-          "Provided filename (" + fileName + ") contains invalid characters.");
+    for (int i = 0; i < fileName.length(); i++) {
+      final char ch = fileName.charAt(i);
+      if (!(Character.isLetterOrDigit(ch) || ch == '-' || ch == '.' || ch == 
'_')) {
+        throw new IllegalArgumentException(
+            "Provided filename (" + fileName + ") contains invalid 
characters.");
+      }

Review Comment:
   The following benchmark used the final implementation:
   ```
   Benchmark                                                   (splitsRfile)  
Mode  Cnt    Score    Error  Units
   GarbageCollectorPerformanceIT.benchmarkReferences                   1,100  
avgt    3    1.385 ±  0.070  ms/op
   GarbageCollectorPerformanceIT.benchmarkReferences:rfile/op          1,100  
avgt    3    0.014 ±  0.001  ms/op
   GarbageCollectorPerformanceIT.benchmarkReferences                  10,100  
avgt    3    6.865 ±  3.233  ms/op
   GarbageCollectorPerformanceIT.benchmarkReferences:rfile/op         10,100  
avgt    3    0.007 ±  0.003  ms/op
   GarbageCollectorPerformanceIT.benchmarkReferences                 100,100  
avgt    3   40.292 ± 14.152  ms/op
   GarbageCollectorPerformanceIT.benchmarkReferences:rfile/op        100,100  
avgt    3    0.004 ±  0.001  ms/op
   GarbageCollectorPerformanceIT.benchmarkReferences                1000,100  
avgt    3  245.171 ± 46.164  ms/op
   GarbageCollectorPerformanceIT.benchmarkReferences:rfile/op       1000,100  
avgt    3    0.002 ±  0.001  ms/op
   ```



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

Reply via email to