Integrated: 8253641: Missing newline in the printout of certain JFR events
Michael Bien
github.com+114367+mbien at openjdk.java.net
Tue Oct 20 17:51:16 UTC 2020
On Fri, 18 Sep 2020 11:29:21 GMT, Michael Bien <github.com+114367+mbien at openjdk.org> wrote:
> Trivial fix which adds a missing new line to PrettyWriter::printClassLoader if clazz == null.
>
> PrettyWriter is used for both the jfr CLI tool and also for the impl of the public JFR API behind
> jdk.jfr.Event::toString().
> how to reproduce using JFR CLI:
>
> To generate a JFR dump for testing, simply start HelloWorld.java
> public class HelloWorld {
> public static void main(String[] args) {System.out.println("hello there");}
> }
> with
> `jdk-15+36/bin/java -XX:StartFlightRecording=filename=dump.jfr,dumponexit=true HelloWorld.java`
>
>
> current result for events where the classLoader field equals null (note: newline missing):
>
> jdk-15+36/bin/jfr print --events jdk.ModuleRequire dump.jfr
> ...
> jdk.ModuleRequire {
> startTime = 16:12:43.524
> source = {
> name = "jdk.nio.mapmode"
> version = "15"
> location = "jrt:/jdk.nio.mapmode"
> classLoader = null }
> requiredModule = {
> name = "java.base"
> version = "15"
> location = "jrt:/java.base"
> classLoader = null }
> }
> ...
>
> after the patch, using same jfr dump and displaying the same event:
>
> jdk16/build/linux-x86_64-server-release/jdk/bin/jfr print --events jdk.ModuleRequire dump.jfr
> ...
> jdk.ModuleRequire {
> startTime = 16:12:43.524
> source = {
> name = "jdk.nio.mapmode"
> version = "15"
> location = "jrt:/jdk.nio.mapmode"
> classLoader = null
> }
> requiredModule = {
> name = "java.base"
> version = "15"
> location = "jrt:/java.base"
> classLoader = null
> }
> }
> ...
>
> sidenote:
>
> There would be an opportunity to merge the two sequential if-else blocks[1] in printClassLoader over the clazz variable
> after this patch, but this would obfuscate the actual bug fix, so I decided to omit it. Let me know if I should add
> that. [1]
> https://github.com/mbien/jdk/blob/67750e2b599b3f2a6b814d7bceada785ca4051f9/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/PrettyWriter.java#L440-L448
This pull request has now been integrated.
Changeset: e577c8c8
Author: Michael Bien <mbien42 at gmail.com>
Committer: Markus Grönlund <mgronlun at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/e577c8c8
Stats: 6 lines in 1 file changed: 4 ins; 1 del; 1 mod
8253641: Missing newline in the printout of certain JFR events
Co-authored-by: Michael Bien <mbien42 at gmail.com>
Reviewed-by: mgronlun
-------------
PR: https://git.openjdk.java.net/jdk/pull/248
More information about the hotspot-jfr-dev
mailing list