File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed
libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change 2121
2222public final class FileAccessTree {
2323 public static final FileAccessTree EMPTY = new FileAccessTree (List .of ());
24- private static final char FILE_SEPARATOR ;
25-
26- static {
27- String separator = getDefaultFileSystem ().getSeparator ();
28- if (separator .length () == 1 ) {
29- FILE_SEPARATOR = separator .charAt (0 );
30- } else {
31- throw new IllegalStateException ("Multi-character file separator not supported: [" + separator + "]" );
32- }
33- }
24+ private static final String FILE_SEPARATOR = getDefaultFileSystem ().getSeparator ();
3425
3526 private final String [] readPaths ;
3627 private final String [] writePaths ;
@@ -82,7 +73,7 @@ private static boolean checkPath(String path, String[] paths) {
8273 int ndx = Arrays .binarySearch (paths , path );
8374 if (ndx < -1 ) {
8475 String maybeParent = paths [-ndx - 2 ];
85- return path .startsWith (maybeParent ) && path .charAt ( maybeParent .length ()) == FILE_SEPARATOR ;
76+ return path .startsWith (maybeParent ) && path .startsWith ( FILE_SEPARATOR , maybeParent .length ());
8677 }
8778 return ndx >= 0 ;
8879 }
You can’t perform that action at this time.
0 commit comments