RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system
Anthony Vanelverdinghe
anthonyv.be at outlook.com
Fri Mar 6 17:41:45 UTC 2020
Hi Julia
On 06/03/2020 14:04, Julia Boes wrote:
> Hi Anthony,
>
> Thanks for your comments.
>
>> For distinguishing the non-default filesystem case, an alternative to
>> using the try-catch block
>> is an if-else block with the same check as is done in Path::toFile:
>> if (path.getFileSystem() == FileSystems.getDefault())
>
> Path::toFile can be overridden so the try-catch block potentially
> covers more cases.
Good point, I hadn't thought of that.
>
>>
>> When setting `length`, the catch clause can be limited to
>> IOException, rather than Exception.
> Good catch, changed.
>>
>> Maybe change the method `RuntimeException toUncheckedException(...)`
>> to `void throwAsUncheckedException(...)`
>> and then instead of `throw toUncheckedException(...)` use
>> `throwAsUncheckedException(...)`
>
> In that case FilePublisher::createInputStream would be missing a
> return statement. The original version makes it explicit that we
> always throw something - I'll stick to the original version if that's
> ok with you.
I see now, thanks, and agree the original version is preferable.
> Webrev is updated.
>
> Cheers,
>
> Julia
>
>
Kind regards,
Anthony
More information about the net-dev
mailing list