[ BUG ? ] simple code throws on Windows but works fine on *nix
sergei.tsypanov at yandex.ru
Tue Jul 2 08:48:48 UTC 2019
then I'll use URI in my code.
Thanks for explanation, I was sure something is wrong with JDK.
02.07.2019, 10:36, "Daniel Fuchs" <daniel.fuchs at oracle.com>:
> Hi Sergey,
> On 02/07/2019 10:25, Сергей Цыпанов wrote:
>> this is exactly how I've worked this around.
>> But shouldn't behaviour be the same on all platforms
>> at least when accessing files on a local drive?
> Hierarchical URLs/URIs are specified to use '/' as file separator
> This is platform independent.
> On the other hand file systems are platform dependents:
> the file system file separator is '/' on UNIX and '\' on
> Therefore converting a URL path to a String and then feeding
> it to the file system without any validation/conversion is a bug
> in your code. As Alan mentioned, an URL path is not a file path
> even if it looks like it.
> Using Path.of(URI) is the right API, and not a work around.
> best regards,
> -- daniel
>> Sergey Tsypanov
More information about the core-libs-dev