Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8198732

ThreadInfo.from(CompositeData) does not throw IAE when the given CompositeData with missing attributes

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 11
    • core-svc
    • None
    • behavioral
    • low
    • Hide
      The implementation will throw IAE if the given CompositeData is invalid while
      it might be accepted in the current release.

      ThreadInfo and StackTraceElement in JDK 9 added a couple new attributes.
      Typically CompositeData for ThreadInfo is generated by JMX API and is valid.
      An invalid CompositeData would be one with the new daemon and
      priority attributes but missing JDK 6 attributes. Such invalid CompositeData
      would only be generated manually for example for testing.

      So the compatibility risk is low.
      Show
      The implementation will throw IAE if the given CompositeData is invalid while it might be accepted in the current release. ThreadInfo and StackTraceElement in JDK 9 added a couple new attributes. Typically CompositeData for ThreadInfo is generated by JMX API and is valid. An invalid CompositeData would be one with the new daemon and priority attributes but missing JDK 6 attributes. Such invalid CompositeData would only be generated manually for example for testing. So the compatibility risk is low.
    • Java API
    • SE

      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.

            mchung Mandy Chung (Inactive)
            jmanson Jeremy Manson (Inactive)
            Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: