RFR: CODETOOLS-7903331: jtreg fails with StringIndexOutOfBoundsException: Index -1 out of bounds for length 0

Jonathan Gibbons jjg at openjdk.org
Tue Oct 11 22:29:01 UTC 2022


Please review a simple fix, with new test, for a recently discovered issue, such that including "." in a test group (to mean "all tests") caused an exception.

Updating to JT Harness 6+24 improved the reporting of the exception but did not fix the root cause.

The root cause came from jtreg setting an empty path for an "initial URL" in the `Parameters` object. 

In `TestManager.getTests` there was already precedent for returning `null` to mean "all tests", for tests specified on the command line.  The fix is to extend that precedent to tests found in groups as well.

There is an existing test `GroupTest`, but that one intentionally has an invalid test which should not normally be read, since it causes a parse failure when reading tests.   So a new test is added, with different flavors of including "all" tests. In addition, since the original JDK bug was discovered in relation to the new `-report:files` option, the tests are extended to use that option as well.

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

Commit messages:
 - CODETOOLS-7903331: jtreg fails with StringIndexOutOfBoundsException: Index -1 out of bounds for length 0

Changes: https://git.openjdk.org/jtreg/pull/131/files
 Webrev: https://webrevs.openjdk.org/?repo=jtreg&pr=131&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7903331
  Stats: 90 lines in 9 files changed: 73 ins; 0 del; 17 mod
  Patch: https://git.openjdk.org/jtreg/pull/131.diff
  Fetch: git fetch https://git.openjdk.org/jtreg pull/131/head:pull/131

PR: https://git.openjdk.org/jtreg/pull/131


More information about the jtreg-dev mailing list