dsmiley commented on code in PR #2924:
URL: https://github.com/apache/solr/pull/2924#discussion_r1919166386
##########
solr/core/src/java/org/apache/solr/filestore/DistribFileStore.java:
##########
@@ -458,25 +458,25 @@ public void syncToAllNodes(String path) throws
IOException {
}
@Override
- public List<FileDetails> list(String path, Predicate<String> predicate) {
- File file = getRealpath(path).toFile();
+ public List<FileDetails> list(String path, Predicate<String> predicate)
throws IOException {
+ Path file = getRealpath(path);
List<FileDetails> fileDetails = new ArrayList<>();
FileType type = getType(path, false);
if (type == FileType.DIRECTORY) {
- file.list(
- (dir, name) -> {
- if (predicate == null || predicate.test(name)) {
- if (!isMetaDataFile(name)) {
- fileDetails.add(new FileInfo(path + "/" + name).getDetails());
+ try (Stream<Path> fileStream = Files.list(file)) {
+ fileStream.forEach(
+ (f) -> {
+ String fileName = f.getFileName().toString();
+ if (predicate == null || predicate.test(fileName)) {
+ if (!isMetaDataFile(fileName)) {
Review Comment:
I don't recommend doing that now. Path *can* be used for systems that
aren't _exactly_ a file system but probably requires a custom
FileSystemProvider which is a lot of work. We have a number of APIs that have
a more abstract notion of a file system; they use String today (instead of
File/Path) for this reason.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]