Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-24 Thread Amy Lu
Thank you Julia! Looks good to me. Thanks, Amy On 3/24/20 11:01 PM, Julia Boes wrote: Hi Amy, Just a minor comment on the test usage of /othervm/java.security.policy=FilePublisherPermsTest3.policy -Djava.security.manager As jtreg tag-spec [1] suggested:   The setting of the system propert

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-24 Thread Daniel Fuchs
OK, thanks for double checking Julia. Looks good to me then! best regards, -- daniel On 24/03/2020 16:33, Julia Boes wrote: Hi Daniel, * @run testng/othervm/java.security.policy=FilePublisherPermsTest1.policy Does this actually work as expected? I thought the syntax was: @run testng/other

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-24 Thread Julia Boes
Hi Daniel, * @run testng/othervm/java.security.policy=FilePublisherPermsTest1.policy Does this actually work as expected? I thought the syntax was: @run testng/othervm/policy= I couldn't get the test to run with the latter but noticed that most tests that are run with testng use the 'java.s

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-24 Thread Daniel Fuchs
Hi Julia, * @run testng/othervm/java.security.policy=FilePublisherPermsTest1.policy Does this actually work as expected? I thought the syntax was: @run testng/othervm/policy= And FWIW there some subtlety with othervm/policy= versus othervm/policy== and I never remember which one should be

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-24 Thread Chris Hegarty
> On 24 Mar 2020, at 15:01, Julia Boes wrote: > ... > > Updated webrev: http://cr.openjdk.java.net/~jboes/webrevs/8235459/webrev.03/ LGTM. -Chris.

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-24 Thread Julia Boes
Hi Amy, Just a minor comment on the test usage of /othervm/java.security.policy=FilePublisherPermsTest3.policy -Djava.security.manager As jtreg tag-spec [1] suggested:   The setting of the system properties "java.security.manager" and "java.security.policy" in main/othervm actions is also d

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-23 Thread Amy Lu
On 3/24/20 1:51 AM, Julia Boes wrote: Updated webrev: http://cr.openjdk.java.net/~jboes/webrevs/8235459/webrev.03/ Hi, Julia Just a minor comment on the test usage of /othervm/java.security.policy=FilePublisherPermsTest3.policy -Djava.security.manager As jtreg tag-spec [1] suggested:   The

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-23 Thread Julia Boes
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

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-12 Thread Daniel Fuchs
Hi Julia, I think we need to revisit the public static FilePublisher create(Path path) a bit. 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

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-12 Thread Julia Boes
Thanks for the review, Chris. After running further httpclient tests, I had to adjusted the exception handling of an existing test, RelayingPublishers. I also added a check in FilePublisher::createInputStream to throw if the path is of a directory. Updated webrev: http://cr.openjdk.java.net

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-10 Thread Chris Hegarty
Julia, > On 5 Mar 2020, at 13:50, Julia Boes wrote: > > Hi, > > Please see this fix that adds support for non-default file systems to the > HttpClient. More specifically, the change is in > RequestPublishers.FilePublisher where an UnsupportedOperationException is > thrown if a java.io.File c

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-06 Thread Anthony Vanelverdinghe
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() == FileSystem

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-06 Thread Julia Boes
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 s

Re: RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-05 Thread Anthony Vanelverdinghe
Hi Julia Here's some suggestions w.r.t. RequestPublishers.java: 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()) When se

RFR: 8235459: HttpRequest.BodyPublishers#ofFile(Path) assumes the default file system

2020-03-05 Thread Julia Boes
Hi, Please see this fix that adds support for non-default file systems to the HttpClient. More specifically, the change is in RequestPublishers.FilePublisher where an UnsupportedOperationException is thrown if a java.io.File cannot be obtained. The exception is now caught and a function is us