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

Roger Riggs rriggs at openjdk.java.net
Wed Nov 3 14:18:23 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.

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

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

Changes: https://git.openjdk.java.net/jdk/pull/6233/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6233&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8276408
  Stats: 21 lines in 1 file changed: 21 ins; 0 del; 0 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