File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
lucene/test-framework/src/java/org/apache/lucene/tests/mockfile Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 2424import java .nio .file .attribute .BasicFileAttributes ;
2525import java .util .HashMap ;
2626import java .util .Map ;
27+ import java .util .Optional ;
2728
2829/**
2930 * FileSystem that (imperfectly) acts like windows.
@@ -54,13 +55,10 @@ public WindowsFS(FileSystem delegate) {
5455
5556 /** Returns file "key" (e.g. inode) for the specified path */
5657 private Object getKey (Path existing ) throws IOException {
57- Object key = Files .readAttributes (existing , BasicFileAttributes .class ).fileKey ();
58- if (key != null ) {
59- return key ;
60- }
6158 // the key may be null, e.g. on real Windows!
6259 // in that case we fallback to the real path
63- return existing .toRealPath ();
60+ return Optional .ofNullable (Files .readAttributes (existing , BasicFileAttributes .class ).fileKey ())
61+ .orElse (existing );
6462 }
6563
6664 @ Override
You can’t perform that action at this time.
0 commit comments