RFR: JMC-9999 Allowing char attribute to be parsed [v3]
Marcus Hirt
hirt at openjdk.java.net
Wed Mar 2 14:15:10 UTC 2022
On Fri, 25 Feb 2022 15:45:40 GMT, Gunnar Morling <duke at openjdk.java.net> wrote:
>> 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!
>
> Gunnar Morling has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains two new commits since the last revision:
>
> - JMC-9999 Improving misleading variable name
> - JMC-9999 Allowing char attribute to be parsed
Marked as reviewed by hirt (Lead).
-------------
PR: https://git.openjdk.java.net/jmc/pull/378
More information about the jmc-dev
mailing list