RFR: JMC-9999 Allowing char attribute to be parsed [v2]

Gunnar Morling duke at openjdk.java.net
Fri Feb 25 15:37:37 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!

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

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

Changes:
  - all: https://git.openjdk.java.net/jmc/pull/378/files
  - new: https://git.openjdk.java.net/jmc/pull/378/files/51864877..4eb310bc

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jmc&pr=378&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jmc&pr=378&range=00-01

  Stats: 107 lines in 3 files changed: 104 ins; 0 del; 3 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