RFR: 8191441: (Process) add Readers and Writer access to java.lang.Process streams

Bernd Eckenfels ecki at zusammenkunft.net
Thu May 20 21:30:39 UTC 2021


Hello,

Hm, how is that list used? - StandardCharaet.ISO_8859_1 is a guaranteed Charset for JVM, and since the encoding is done in Java it should be fine. Added benefit is, it’s 8bit transparent.

As for OS there is not a single standard charset (ebcdic vs latin families) but ASCII is probably the widest available (with latin1 variants to follow)


--
https://Bernd.eckenfels.net
________________________________
From: core-libs-dev <core-libs-dev-retn at openjdk.java.net> on behalf of Roger Riggs <rriggs at openjdk.java.net>
Sent: Thursday, May 20, 2021 10:52 PM
To: core-libs-dev at openjdk.java.net
Subject: Re: RFR: 8191441: (Process) add Readers and Writer access to java.lang.Process streams

On Thu, 20 May 2021 20:42:35 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Methods are added to java.lang.Process to read and write characters and lines from and to a spawned Process.
>> The Charset used to encode and decode characters to bytes can be specified or use the
>> operating system native encoding as is available from the "native.encoding" system property.
>
> test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java line 64:
>
>> 62:         return new Object[][] {
>> 63:                 {"UTF-8"},
>> 64:                 {"ISO8859-1"},
>
> `ISO8859-1` may not be available on all underlying OSes.

Is there a safe subset?
I haven't seen a failure yet, if/when it occurs, we make an exception or narrow the test to known systems.

> test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java line 111:
>
>> 109:     @Test(dataProvider = "CharsetCases", enabled = true)
>> 110:     void testCase(String nativeEncoding) throws IOException {
>> 111:         String osName = System.getProperty("os.name").toLowerCase(Locale.ROOT);
>
> Not used anywhere else.

Right, dead code now without host dependencies.

> test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java line 122:
>
>> 120:                 "ReaderWriterTest$ChildWithCharset");
>> 121:         var env = pb.environment();
>> 122:         env.put("LANG", "en_US." + cleanCSName);
>
> Does this work on Windows?

Should be removed, the tests work because they set sun.stdout/stderr.encoding.

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

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


More information about the core-libs-dev mailing list