On Wed, 23 Apr 2025 15:39:35 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

>> test/jdk/java/io/BufferedReader/ReadAll.java line 83:
>> 
>>> 81:                 int toIndex = rnd.nextInt(fromIndex, plen);
>>> 82:                 String str = PHRASE.substring(fromIndex, toIndex);
>>> 83:                 byte[] strBytes = str.getBytes();
>> 
>> The test will fail if the default Charset is not UTF-8:
>> `String.getBytes()` and` FileReader(File)` use the default Charset, 
>> `Files.readAllLines(Path)` and `Files.readString(Path)` use UTF-8.
>
>> The test will fail if the default Charset is not UTF-8
> 
> When does that happen (cf. [JEP 400)](https://openjdk.org/jeps/400)?

The default charset is not UTF-8 when you specify JVM param -Dfile.encoding, 
which of course is unlikely in the environment which executes the test. But 
imho being explicit about the charset does not hurt.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2056387430

Reply via email to