RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system
Julia Boes
julia.boes at oracle.com
Mon Mar 23 17:51:48 UTC 2020
Hi Daniel,
> We should try to call Path::toFile first - whether there is a security
> manager or not. In the case where that succeeds, we can use
> new FileInputStream(), otherwise, we use Files.newInputStream.
>
> It's unfortunate that new FileInputStream() and Files.newInputStream()
> use different sets of exceptions, and that our public signature use
> the exception thrown by the former.
>
> Keeping using new FileInputStream() for the case where the Path::toFile
> returns a file will ensure that we preserve backward compatibility
> with existing code, but the current implementation of create() is
> missing the case where there is no security manager and
> Path::toFile doesn't throw.
Thanks for the input, I adjusted the changes to FilePublisher
accordingly. All relevant tests pass on repeat 50.
Updated webrev: http://cr.openjdk.java.net/~jboes/webrevs/8235459/webrev.03/
Regards,
Julia
More information about the net-dev
mailing list