RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system
    Julia Boes 
    julia.boes at oracle.com
       
    Fri Mar  6 13:04:54 UTC 2020
    
    
  
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.
>
> 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.
Webrev is updated.
Cheers,
Julia
    
    
More information about the net-dev
mailing list