-
Notifications
You must be signed in to change notification settings - Fork 155
Fixed url to file conversion breaking paths with spaces #25448
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
Conversation
.map(File::new) | ||
.map(File::getAbsolutePath) | ||
.collect(Collectors.joining(File.pathSeparator)); | ||
return urls.map(FileUtils::toFile).map(File::getAbsolutePath).collect(Collectors.joining(File.pathSeparator)); |
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.
I'd keep original line breaks to show that only part of the method changed, not the whole one.
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.
It is under 120 characters border, so it is not so hard to read. I would agree otherwise.
nucleus/common/common-util/src/main/java/com/sun/enterprise/util/io/FileUtils.java
Outdated
Show resolved
Hide resolved
...eus/core/kernel/src/main/java/com/sun/enterprise/v3/server/CommonClassLoaderServiceImpl.java
Show resolved
Hide resolved
- This conversion is used very often and I got tired of all issues with that. Signed-off-by: David Matějček <[email protected]>
Signed-off-by: David Matějček <[email protected]>
- Added coverage of paths with spaces - Added coverage of adding an empty file path Signed-off-by: David Matějček <[email protected]>
- Original code broke when path contained spaces - Added validation of the path before it was added anywhere. - Note that FileUtils.toFile throws IAE when the path is empty too, however this code is now probably unreachable because of the validation. Signed-off-by: David Matějček <[email protected]>
This PR fixes part of issues seen when manually testing another branch on Windows using path with spaces.
Fixes also a validation issue when URL with empty path could pass into the classloader.
I have cherrypicked also another commit refactoring test which I needed here to confirm issues we have noticed in sources.