RFR: 8287800: JFR: Incorrect error message when starting recording with missing .jfc file

Erik Gahlin egahlin at openjdk.org
Mon Jun 20 03:19:27 UTC 2022


Could I have review of PR that fixes incorrect error messages when starting a recording.

The current message is very confusing. If a user types`jcmd <pid> JFR.start settings=my.jfc`, but doesn't realise that the path should be relative to where the JVM started, the error message says "Could not parse settings file custom.jfc"

It should say "Could not **find** file custom.jfc"

Furthermore, if a user specifies `settings=default.jfc settings=my.jfc`to get settings from two files, the error message will say "Could not parse file default.jfc", even though it was my.jfc it was unable to find.

This problem impacts `jfr configure`, `-XX:StartFlightRecording` and `JFR.start`. Code has been refactored so error formatting now happens per file and in one place with a proper verb ("find", "parse", "use", "access", "open"). Error messages from the parser are also propagated, for example: "Could not parse file 'my.jfc". Expected root element to be named 'configuration'"

Testing: jdk/jdk/jfr

Thanks
Erik

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

Commit messages:
 - Fix whitespace
 - Initial

Changes: https://git.openjdk.org/jdk19/pull/43/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk19&pr=43&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8287800
  Stats: 225 lines in 14 files changed: 101 ins; 52 del; 72 mod
  Patch: https://git.openjdk.org/jdk19/pull/43.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/43/head:pull/43

PR: https://git.openjdk.org/jdk19/pull/43


More information about the hotspot-jfr-dev mailing list