-
CSR
-
Resolution: Approved
-
P2
-
None
-
behavioral
-
low
-
An exception is thrown today when serializing over JMX, so the functionality has never worked as intended. It's, therefore, unlikely to cause any problems. The proposed solution also accepts the attributes specified in earlier releases.
-
Other
-
JDK
Summary
Change the specification of the method jdk.management.jfr.EventTypeInfo::from(CompositeData), so it uses the attributes 'settingDescriptors' and 'categoryNames' instead of 'settings' and 'category'.
Problem
The FlightRecorderMXBean allows users to interact with JFR remotely. One operation is to get event settings, for example, enablement and thresholds, so a JMX client can configure events from another machine. The information is stored in the class EventTypeInfo, and it has a method called getSettingDescriptors() where users can find out which settings an event have.
The problem is that deserialization from CompositeData to EventTypeInfo is incorrect because the method uses two attributes: 'settings' and 'category', but it should be 'settingDescriptors' and 'categoryNames'.
Solution
Javadoc for the method jdk.management.jfr.EventTypeInfo::from(CompositeData), in the jdk.management.jfr module states the attribute names should be 'settings' and 'category', but JDK Mission Control looks up data reflectively and uses the correct attributes 'settingDescriptors' and 'categoryNames'. Since the method doesn't work for deserialization today, changing the spec is reasonable to match the implementation. It also accepts 'settings' and 'category' in the unlikely case there is code that depends on it.
The alternative, to rename the methods getSettingDescriptors() to getSettings() and getCategoryNames() to getCategory(), is too disruptive. JMC, or any other JMX client that relies on the attribute settingDescriptors or categoryNames, will break. Renaming the methods is also a binary incompatibility in case the methods are invoked directly (not remotely) where deserialization doesn't occur.
Specification
jdk.management.jfr.EventTypeInfo::from(CompositeData)
@@ -229,11 +237,11 @@ public final class EventTypeInfo {
* <td>{@code String}</td>
* </tr>
* <tr>
- * <th scope="row">category</th>
+ * <th scope="row">categoryNames</th>
* <td><code>ArrayType(1, SimpleType.STRING)</code></td>
* </tr>
* <tr>
- * <th scope="row">settings</th>
+ * <th scope="row">settingDescriptors</th>
* <td>{@code javax.management.openmbean.CompositeData[]} whose element type
* is the mapped type for {@link SettingDescriptorInfo} as specified in the
* {@link SettingDescriptorInfo#from} method.</td>
- csr of
-
JDK-8308876 JFR: Deserialization of EventTypeInfo uses incorrect attribute names
-
- Closed
-