On Fri, 17 Jun 2022 10:43:31 GMT, Alan Bateman <al...@openjdk.org> wrote:

> Files.readString has been broken several times by the changes in to String in 
> this area. Would it be possible to survey the tests that we have for this 
> method, esp. the error cases, to see if we need more tests.

I looked for similar test cases but ended up finding nothing. Thus I created a 
new test case here. Problem is that they are issued through `SharedSecrets`, 
which are effectively *APIs* but treated as private methods which leads to 
insufficient testing. I now think that I would add not only b2c test, but also 
c2b test (for getBytesNoRepl() method) is needed. I will modify the test case 
to include it.

BTW, I found a spec bug in `Files.writeString()` w/o `Charset` argument, where 
the `@throws` clause reads: 
"[IOException](https://urldefense.com/v3/__https://download.java.net/java/early_access/jdk19/docs/api/java.base/java/io/IOException.html__;!!ACWV5N9M2RV99hQ!KboVU1MBg56sylrGOkI7-hqJs9RQOLKUEejCyalJMNSXnmMUGsWmw_UdcI3MAQoK6xhmE-5MlPGfAoMi3zyK5Q$
 ) - if an I/O error occurs writing to or creating the file, or the text cannot 
be encoded using the specified charset", but there is no specified charset 
there.

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

PR: https://git.openjdk.org/jdk/pull/9193

Reply via email to