JDK-8198732 : ThreadInfo.from(CompositeData) does not throw IAE when the given CompositeData with missing attributes
  • Type: CSR
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 11
  • Submitted: 2018-02-27
  • Updated: 2018-03-05
  • Resolved: 2018-02-28
Related Reports
CSR :  
Description
Summary
-------

`ThreadInfo::from` should throw IAE when the given `CompositeData` does
not contain all the attributes specified for `ThreadInfo` of a specific version.

Problem
-------

`ThreadInfo::from` accepts `CompositeData` representing `ThreadInfo` of
the current and earlier release.   This method intends to validate the given
`CompositeData` and throw IAE if it does not represent a valid `ThreadInfo`.
For example, `lockedSynchronizers` and `lockedMonitors` must be present
if it represents JDK 6 or 9 `ThreadInfo`.   The spec needs clarification.
In addition while fixing this issue, `stackTrace` attribute represents 
`StackTraceElement` but the spec is missing `classLoaderName` attribute.

Solution
--------

Update the spec of `ThreadInfo::from` method to specify the release of each attribute 
was defined.  A valid `CompositeData` representing a `ThreadInfo` of version N 
must contain all the attributes defined <= N.  Same rule applies transitively to  
attributes whose type or component type is `CompositeType`.

Specification
-------------

See attached specdiff.
Comments
Moving to approved.
28-02-2018

MonitorInfo does not have any new attributes. Instead "lockedMonitors" attribute must contain "lockedStackFrame" attribute representing StackTraceElement of the same version. The spec should state that the same rule applies to attributes whose type or component type is CompositeType.
27-02-2018