On Tue, 17 Oct 2023 20:16:18 GMT, Chris Plummer <[email protected]> wrote:
>> Johannes Bechberger has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Fixed event location
>
> test/jdk/com/sun/jdi/JdwpOnThrowTest.java line 76:
>
>> 74: while(eventIterator.hasNext() && start + TIMEOUT >
>> System.currentTimeMillis()) {
>> 75: Event event = eventIterator.next();
>> 76: if (event instanceof ExceptionEvent ex) {
>
> It's a bit unclear to me why this test is even seeing the ExceptionEvent
> since I don't see any place where an ExceptionEventRequest has been setup.
It seems that ex.request()) is null for this event. The spec for
Event.request() says null might happen for VMDeath events, but doesn't mention
any other. In any case, I guess JDI does not filter out any events for which
there is not a request, which is why the test is seeing it. This also means the
event could be considered unexpected if the debugger did not explicitly add an
ExceptionEventRequest, and it could in fact cause an NPE if the debugger
decides to look at ex.request().
On the other hand, I think if the debug agent requires that a handler be in
place (as a result of the debugger creating and enabling the EventRequest) in
order for onthrow to send the event, then the handler creation might come too
late, and the event will get filtered out.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16145#discussion_r1362734011