RFR: 8276408: Deprecate Runtime.exec methods with a single string command line argument [v2]

Roger Riggs rriggs at openjdk.java.net
Fri Nov 5 20:00:24 UTC 2021


> 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.

Roger Riggs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge branch 'master' into 8276408-deprecate-runtime-exec
 - Updated tests to remove use of deprecated exec methods and
   to suppress deprecation warnings where testing of the deprecated methods is intended.
 - 8276408: Deprecate Runtime.exec methods with a single string command line argument

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/6233/files
  - new: https://git.openjdk.java.net/jdk/pull/6233/files/d27df301..79ddf8ca

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6233&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6233&range=00-01

  Stats: 407437 lines in 719 files changed: 204020 ins; 194672 del; 8745 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6233.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6233/head:pull/6233

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


More information about the core-libs-dev mailing list