RFR: 8376052: Use AttachOperationFailedException rather than AttachNotSupportedException in findTargetProcessTmpDirectory() [v2]
Yasumasa Suenaga
ysuenaga at openjdk.org
Thu Jan 22 08:20:08 UTC 2026
On Thu, 22 Jan 2026 07:27:01 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Yasumasa Suenaga has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix typo
>
> src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java line 301:
>
>> 299: } catch (MonitorException | URISyntaxException e) {
>> 300: // Other exceptions (happened at MonitoredHost) would be wrapped with AttachOperationFailedException
>> 301: throw new AttachOperationFailedException("Unable to find target proces", e);
>
> Would it be possible to paste in some examples of the cause?
We would not see these exceptions TBH - they are just checked exceptions on `getMonitoredHost()` and `activeVms()`.
`sun.jvmstat.perfdata.monitor.protocol.local.MonitoredHostProvider` would be instanciated by default when we pass `//localhost` to `getMonitoredHost()`. Both c'tor of `MonitoredHostProvider` and `activeVms()` do not have any `throws` clause. And also `MonitoredHostLocalService` which is loaded by ServiceLoader would not throw any exceptions.
`URISyntaxException` comes from `URI` members, but it would not happen because `//localhost` is hard coded, and I believe it does not happen any exceptions on `URI`.
The class inherits `MonitoredHost` might be instantiated by user-defined provider class of course, so these checked exceptions should be reported as the cause.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29355#discussion_r2715792198
More information about the serviceability-dev
mailing list