Integrated: 8276408: Deprecate Runtime.exec methods with a single string command line argument

Roger Riggs rriggs at openjdk.java.net
Mon Nov 8 16:41:44 UTC 2021


On Wed, 3 Nov 2021 14:09:13 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> The three `java.lang.Runtime.exec` methods that tokenize a command line to produce an array of string arguments are easily misused, sometimes with erroneous results. For example, on some operating systems, spaces are supported in filenames and are in common use.
> 
> The tokenization uses only whitespace characters, ignoring quote characters. It is error prone because quotes may appear in the string but are ignored. The implementation (on Windows) includes a heuristic for the executable argument that tries to re-parse the command line respecting quotes but it is undocumented.

This pull request has now been integrated.

Changeset: 7e73bca0
Author:    Roger Riggs <rriggs at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/7e73bca0b7a34af9fb73780491951539815651b4
Stats:     30 lines in 5 files changed: 26 ins; 0 del; 4 mod

8276408: Deprecate Runtime.exec methods with a single string command line argument

Reviewed-by: alanb

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

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


More information about the core-libs-dev mailing list