-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue with resource files not loaded on Ubuntu Linux #5898
Conversation
FileSystem fileSystem = FileSystems.newFileSystem(dirUrl.toURI(), Collections.emptyMap()); | ||
List<Path> filePaths = Files.walk(fileSystem.getPath(resourceDir), 1).collect(Collectors.toList()); | ||
if (filePaths.size() <= 1) { | ||
log.info("No files in directory. {}", dirUrl.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toString is not necessary.
log.info("No files in directory. {}", dirUrl.toString()); | |
log.info("No files in directory. {}", dirUrl); |
Doesn't work now on macOS unfortunately
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NACK - #5898 (comment)
I was debugging the same issue on Windows a couple of days ago, caused by the expression It looks like you have to use two different code paths to list the resource directory, depending on the environment. (I created a draft patch for the fix, but never got round to creating a PR out of it. The foreach loop to do the copying needs modifying to work on Windows as well, just like in this PR.) |
@stejbac Looks like we were both debugging the same issue. As this one does not work for MacOs, can you make your PR? |
@jmacxx OK, sure. |
@stejbac Ah great that you tackled that as well. Could we extract the handling in a FileUtil class to make it re-usable. A pity that simple filehandling from resources is such a mess in java... |
On Ubuntu Linux the attempt to enumerate DAO block files in a JAR resource directory fails.
See #5894 (comment)
All the block data is then downloaded from the seednodes.
This PR does the enumeration using
nio.File.FileSystem
so that block files in resources can be used.