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
PathEditor cannot handle absolute Windows paths with forward slashes #29881
Comments
Hi, I would like to contribute to this issue can you assign this issue to me? Can you let me know how I can go about solving this issue? |
Hi @sreenath-tm, Thanks for making the offer, but please hold off on submitting a PR. This issue is still labeled as |
The value is not a path but an URL that ultimately delegates to tested.setAsText("file:///c:/tmp"); |
May I kindly ask you to reconsider this? I find it very counterintuitive that a class called The reliance on |
Alright. I thought using it as an URI was actually expected to avoid ending in a situation where we'd have too many fallbacks. We've discussed this and @jhoeller thinks we can make the fallback more lenient. |
Since Java can handle Windows paths expressed with forward slashes, people usually express any filesystem path in a configuration file with forward slashes, no matter the OS.
However, Spring's
PathEditor
doesn't seem to handle what seems to me like a pretty common case:While
FileEditor
handles this case just fine and the rather obviousPath.of("c:/tmp");
works, the second line will result in:I should mention that, like for
Path.of(...);
, as a user, I wouldn't expect the resulting Path to necessarily exist on the filesystem. An example use-case would be specifying a path at which something should be created by the application. Such a path wouldn't exist at startup.Using: org.springframework:spring-beans:5.3.25
The text was updated successfully, but these errors were encountered: