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

Alan Bateman alanb at openjdk.java.net
Sun May 23 15:38:38 UTC 2021


On Sat, 22 May 2021 01:24:24 GMT, Roger Riggs <rriggs 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.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use BufferedWriter and OutputStreamWriter and address review comments

The updated proposal looks reasonable, as does the names of the methods.

I think the javadoc will need to specify how malformed or unmappable byte sequence are handled.  The implNote does document that it uses InputStreamReader so this means that erroneous input is replaced but this isn't normative text.

It may be useful to specify how these methods are intended to work when the process has terminated. I realise the existing getXXXX aren't clear on this point and maybe they should.

The API note that warns about unpredictable behavior then trying to use both the byte and character stream probably needs to go into the existing methods too.

NPE will need to be documented as I don't think the Process class description has a statement to avoid clutter in the method descriptions. You will eventually need to add the @since javadoc tag too.

Is there more test coverage to come? I don't see tests that exercise the redirect cases or NPE. The test updates includes an adjustment to how SerialFilterTest is run - is that meant to be included?

A formatting nit is that the line lengths are very really long compared to the rest of the source file.

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

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


More information about the core-libs-dev mailing list