On Tue, 27 Sep 2022 12:02:06 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> test/jdk/java/nio/channels/vthread/BlockingChannelOps.java line 206:
>> 
>>> 204:                         assertTrue(n > 0);
>>> 205:                         bb.clear();
>>> 206:                     }
>> 
>> Hello Alan, since `AsynchronousCloseException` is expected here, should we 
>> add a `fail` after this loop if we don't receive that exception
>
> It's an infinite loop as write may need to be called many times before it 
> blocks. So you can't put a `fail` after the loop as it will never be 
> executed. If another exception is thrown then the test will fail.

You are right; I overlooked the part that this `for` loop is infinite. So, for 
this test method to complete, the only way out of that `for` loop is some 
exception getting thrown and we then catch the expected exception and ignore it 
or let the unexpected exception propagate into a test failure. So yes, the 
current code looks fine.

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

PR: https://git.openjdk.org/jdk/pull/10427

Reply via email to