RFR: JMC-9999 Allowing char attribute to be parsed
Gunnar Morling
duke at openjdk.java.net
Fri Feb 18 10:24:12 UTC 2022
Hey @thegreystone, I noticed that JFR events with `char` attributes cannot be loaded into JMC:
org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileException: Unknown integer type: char
at org.openjdk.jmc.flightrecorder.internal.parser.v1.ValueReaders$PrimitiveReader.readLong(ValueReaders.java:424)
at org.openjdk.jmc.flightrecorder.internal.parser.v1.ValueReaders$QuantityReader.read(ValueReaders.java:192)
at org.openjdk.jmc.flightrecorder.internal.parser.v1.TypeManager$EventTypeEntry.readEvent(TypeManager.java:319)
at org.openjdk.jmc.flightrecorder.internal.parser.v1.TypeManager.readEvent(TypeManager.java:420)
at org.openjdk.jmc.flightrecorder.internal.parser.v1.ChunkLoaderV1.call(ChunkLoaderV1.java:92)
at org.openjdk.jmc.flightrecorder.internal.parser.v1.ChunkLoaderV1.call(ChunkLoaderV1.java:47)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
The code in `ValueReaders::isNumeric` considers `char` to be numeric, causing this to be treated as `long` during parsing later on. With this fix, I can successfully load and examine a recording with such an attribute type using the `RecordingPrinter` (I haven't tried with the JMC UI, as I haven't set up the toolchain required for building it).
If you agree on the fix per se, could you
* log a JMC issue to which I can attribute this fix
* advice me on how/where to test this change (I didn't find any tests in the `flightrecorder` module)
Thanks!
-------------
Commit messages:
- JMC-9999 Allowing char attribute to be parsed
Changes: https://git.openjdk.java.net/jmc/pull/378/files
Webrev: https://webrevs.openjdk.java.net/?repo=jmc&pr=378&range=00
Issue: https://bugs.openjdk.java.net/browse/JMC-9999
Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod
Patch: https://git.openjdk.java.net/jmc/pull/378.diff
Fetch: git fetch https://git.openjdk.java.net/jmc pull/378/head:pull/378
PR: https://git.openjdk.java.net/jmc/pull/378
More information about the jmc-dev
mailing list