JDK-8039173 : Propagate errors from Diagnostic Commands as exceptions in the attach framework
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-04-03
  • Updated: 2017-05-17
  • Resolved: 2014-05-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u40Fixed 9 b14Fixed
Related Reports
Relates :  
Relates :  
In the attach framework, the result is sent back to the attaching process as a stream. The first value in the stream is an integer that is interpreted as the completion status. For successful operations, this value is 0. In that case the attaching process continues to read output from the stream and displays that as the result of the operation.

When the completion status signals an error, the rest of the stream output is ignored. This means that there is currently no way for an attach operation to signal an error and provide an error message.

I would like to change the protocol slightly so that the client continues to read from the stream even if the completion status signalled an error. The data that is read would be considered the error message and would be included as the message in the IOException thrown by the attachers code when an operation fails.
To do this, I propose a new subclass of IOException, AttachOperationFailedException, which will be thrown in these cases from the implementation of VirtualMachine. The client can catch this exception and display the error message as well as signal that the operation failed.
Accidentially reassigned to me.