Re: RFR: 8287541: Files.writeString fails to throw IOException for charset "windows-1252" [v2]

2022-06-07 Thread Andrey Turbanov
On Mon, 6 Jun 2022 15:50:39 GMT, Naoto Sato  wrote:

>> The code path calls `String.getBytesNoRepl()`, but it blindly replaces 
>> unmappable characters with replacements if the encoder is an `ArrayEncoder`. 
>> Changed only to do so if `doReplace` is `true` in 
>> `String.encodeWithEncoder()`.
>
> Naoto Sato has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Changed per suggestion

Marked as reviewed by aturbanov (Committer).

-

PR: https://git.openjdk.java.net/jdk/pull/9019


Re: RFR: 8287541: Files.writeString fails to throw IOException for charset "windows-1252" [v2]

2022-06-06 Thread Naoto Sato
On Sat, 4 Jun 2022 11:27:00 GMT, Andrey Turbanov  wrote:

>> Naoto Sato has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Changed per suggestion
>
> src/java.base/share/classes/java/lang/String.java line 849:
> 
>> 847: int en = scale(len, ce.maxBytesPerChar());
>> 848: // fastpath with ArrayEncoder implies `doReplace`.
>> 849: if (ce instanceof ArrayEncoder ae && doReplace) {
> 
> Wouldn't it be more readable (and perphaps faster) if we do check boolean 
> flag first?

Fixed.

-

PR: https://git.openjdk.java.net/jdk/pull/9019


Re: RFR: 8287541: Files.writeString fails to throw IOException for charset "windows-1252" [v2]

2022-06-06 Thread Naoto Sato
> The code path calls `String.getBytesNoRepl()`, but it blindly replaces 
> unmappable characters with replacements if the encoder is an `ArrayEncoder`. 
> Changed only to do so if `doReplace` is `true` in 
> `String.encodeWithEncoder()`.

Naoto Sato has updated the pull request incrementally with one additional 
commit since the last revision:

  Changed per suggestion

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/9019/files
  - new: https://git.openjdk.java.net/jdk/pull/9019/files/72d27809..51ce3615

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=9019=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=9019=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9019.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9019/head:pull/9019

PR: https://git.openjdk.java.net/jdk/pull/9019