Integrated: 8264512: jdk/test/jdk/java/util/prefs/ExportNode.java relies on default platform encoding
bpb at openjdk.java.net
Mon Apr 5 16:45:23 UTC 2021
On Fri, 2 Apr 2021 21:45:58 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> This test emits to a `java.io.ByteArrayOutputStream` the contents of a `java.utils.prefs.Preferences` node. The `UTF-8` character encoding is used . The `ByteArrayOutputStream` is then converted to a `String` using `toString()` which uses the platform's default character set . The resulting `String` is then checked for the node names that it should and should not contain.
> This change proposes to use `ByteArrayOutputStream.toString(String)` to obtain the string  to maintain consistency of the encoding. It also adds throwing a `RuntimeException` if the node string is not as expected. It is unclear why this test was not already throwing such an exception.
>  https://docs.oracle.com/en/java/javase/16/docs/api/java.prefs/java/util/prefs/Preferences.html#exportNode(java.io.OutputStream)
>  https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/io/ByteArrayOutputStream.html#toString()
>  https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/io/ByteArrayOutputStream.html#toString(java.lang.String)
This pull request has now been integrated.
Author: Brian Burkhalter <bpb at openjdk.org>
Stats: 39 lines in 1 file changed: 21 ins; 0 del; 18 mod
8264512: jdk/test/jdk/java/util/prefs/ExportNode.java relies on default platform encoding
More information about the core-libs-dev