On Sat, 13 Jul 2024 06:21:45 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:

>> 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`?

Because `vm.setFlag` may (and should) throw exception if bad argument is 
specified.
This is what the issue about - on Windows `vm.setFlag` with long argument did 
not throw exception, but truncated the argument, and successfully executed the 
command with truncated argument value.

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

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

Reply via email to