On Fri, 12 Jul 2024 20:37:49 GMT, Alex Menkov <amen...@openjdk.org> wrote:

>> test/hotspot/jtreg/serviceability/attach/LongArgTest.java line 94:
>> 
>>> 92:             HotSpotVirtualMachine vm = 
>>> (HotSpotVirtualMachine)VirtualMachine.attach(String.valueOf(app.getPid()));
>>> 93: 
>>> 94:             if (setFlag(vm)) {
>> 
>> Q: Should the test fail if there an `IOException` was caught in the 
>> `setFlag()` call?
>
> Currently Attach operations have restriction for argument size, so setFlag() 
> is expected to fail for long values.
> This fix adds AttachOperationFailedException for the case on windows, 
> linux/bsd/aix implementations throw generic IOException.
> (There is [JDK-8334168](https://bugs.openjdk.org/browse/JDK-8334168) to throw 
> AttachOperationFailedException instead of IOException if an argument is too 
> long on other platforms)

Not sure, you've answered my question. Let me ask it differently.
Here I do not care about other exceptions on other platforms.
The `setFlag()` can catch an `IOException` at the line 126 and return false in 
that case. The `run()` method at the line 94 is swallowing the `false` value as 
there is no `else` statement. So, we just ignore the `IOException` and do not 
test anything.
My question is: Why don't we throw a `RuntimeException` in the case the 
`setFlag()` returned `false`?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19780#discussion_r1676769508

Reply via email to