Re: RFR: 8257736: InputStream from BodyPublishers.ofInputStream() leaks when IOE happens [v5]

2021-01-14 Thread Yasumasa Suenaga
On Thu, 14 Jan 2021 14:47:47 GMT, Daniel Fuchs wrote: > The updated test looks good. I ran the httpclient tests ~200 times on all > platform and the new test didn't fail. Please integrate and I will sponsor > (if you need a sponsor?). I'm OpenJDK Reviewer (ysuenaga), so I will integrate it.

Integrated: 8257736: InputStream from BodyPublishers.ofInputStream() leaks when IOE happens

2021-01-14 Thread Yasumasa Suenaga
On Fri, 4 Dec 2020 00:47:51 GMT, Yasumasa Suenaga wrote: > `InputStream` from `BodyPublishers.ofInputStream()` is usually closed when > the stream reaches EOF. However IOE handler returns without closing. > > I confirmed this problem in `BodyPublishers.ofInputStream()`, but I think >

Re: RFR: 8257736: InputStream from BodyPublishers.ofInputStream() leaks when IOE happens [v5]

2021-01-14 Thread Chris Hegarty
On Thu, 14 Jan 2021 02:25:25 GMT, Yasumasa Suenaga wrote: >> `InputStream` from `BodyPublishers.ofInputStream()` is usually closed when >> the stream reaches EOF. However IOE handler returns without closing. >> >> I confirmed this problem in `BodyPublishers.ofInputStream()`, but I think >>

Re: RFR: 8257736: InputStream from BodyPublishers.ofInputStream() leaks when IOE happens [v5]

2021-01-14 Thread Daniel Fuchs
On Thu, 14 Jan 2021 02:25:25 GMT, Yasumasa Suenaga wrote: >> `InputStream` from `BodyPublishers.ofInputStream()` is usually closed when >> the stream reaches EOF. However IOE handler returns without closing. >> >> I confirmed this problem in `BodyPublishers.ofInputStream()`, but I think >>

Integrated: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset)

2021-01-14 Thread Сергей Цыпанов
On Thu, 3 Dec 2020 14:29:58 GMT, Сергей Цыпанов wrote: > Instead of allocating a copy of underlying array via > `CharArrayWriter.toCharArray()` and passing it to constructor of String > String str = new String(charArrayWriter.toCharArray()); > we could call `toString()` method > String str =

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v3]

2021-01-14 Thread Сергей Цыпанов
On Wed, 13 Jan 2021 13:48:40 GMT, Claes Redestad wrote: >> Сергей Цыпанов has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains five additional >>

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v3]

2021-01-14 Thread Chris Hegarty
On Thu, 14 Jan 2021 12:48:18 GMT, Сергей Цыпанов wrote: >> Instead of allocating a copy of underlying array via >> `CharArrayWriter.toCharArray()` and passing it to constructor of String >> String str = new String(charArrayWriter.toCharArray()); >> we could call `toString()` method >> String

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v3]

2021-01-14 Thread Claes Redestad
On Thu, 14 Jan 2021 11:48:16 GMT, Claes Redestad wrote: >> @cl4es SB brings pessimization both for time and memory, try >> `org.openjdk.bench.java.net.URLEncodeDecode`: >> master >> (count) (maxLength) >> (mySeed) Mode Cnt Score

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v3]

2021-01-14 Thread Сергей Цыпанов
> Instead of allocating a copy of underlying array via > `CharArrayWriter.toCharArray()` and passing it to constructor of String > String str = new String(charArrayWriter.toCharArray()); > we could call `toString()` method > String str = charArrayWriter.toString(); > decoding existing char[]

Integrated: 8259631: Reapply pattern match instanceof use in HttpClientImpl

2021-01-14 Thread Aleksei Efimov
On Tue, 12 Jan 2021 16:05:01 GMT, Aleksei Efimov wrote: > Hi, > > The proposed change adds back [1] `instanceof` pattern match use to > `HttpClientImpl` class. It was previously removed by > [JDK-8258696](https://bugs.openjdk.java.net/browse/JDK-8258696) due to docs > build failure. > >

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v2]

2021-01-14 Thread Claes Redestad
On Thu, 14 Jan 2021 09:31:19 GMT, Сергей Цыпанов wrote: >> Looks good. >> >> I wonder... `CharArrayWriter` is an old and synchronized data structure, and >> since the instance used here isn't shared that synchronization seem useless. >> And since you're now bypassing the `char[]` and going

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v2]

2021-01-14 Thread Сергей Цыпанов
> Instead of allocating a copy of underlying array via > `CharArrayWriter.toCharArray()` and passing it to constructor of String > String str = new String(charArrayWriter.toCharArray()); > we could call `toString()` method > String str = charArrayWriter.toString(); > decoding existing char[]

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset)

2021-01-14 Thread Сергей Цыпанов
On Wed, 13 Jan 2021 13:48:40 GMT, Claes Redestad wrote: >> Instead of allocating a copy of underlying array via >> `CharArrayWriter.toCharArray()` and passing it to constructor of String >> String str = new String(charArrayWriter.toCharArray()); >> we could call `toString()` method >> String