Restore the interrupt status in UrlChecker.waitUntilUnavailable - #17719
Restore the interrupt status in UrlChecker.waitUntilUnavailable#17719vasiliy-mikhailov wants to merge 2 commits into
Conversation
waitUntilUnavailable caught InterruptedException and rethrew it wrapped in a RuntimeException without re-setting the thread interrupt flag, unlike the sibling waitUntilAvailable. Re-set the flag so callers can still observe the interruption.
PR Summary by QodoRestore interrupt status in UrlChecker.waitUntilUnavailable Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1.
|
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| throw new RuntimeException(e); | ||
| } catch (ExecutionException e) { | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
1. waituntilunavailable missing javadoc 📘 Rule violation ✧ Quality
The modified public method waitUntilUnavailable(long timeout, TimeUnit unit, URL url) has no Javadoc block, so its parameters and TimeoutException contract are undocumented. This violates the requirement for complete Javadoc on changed public API methods.
Agent Prompt
## Issue description
A changed public method `waitUntilUnavailable(...)` lacks a Javadoc block and therefore does not document purpose, `@param` tags, or the `@throws` contract.
## Issue Context
This PR modifies the behavior of `UrlChecker.waitUntilUnavailable`, so it is in-scope for the “complete Javadoc on public API methods” requirement.
## Fix Focus Areas
- java/src/org/openqa/selenium/net/UrlChecker.java[108-114]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
…nterrupt test The @beforeeach created the server but did not start it, so waitUntilUnavailable returned immediately (the URL was already down) before the 500ms interrupt could fire, so the test did not exercise the interrupt path. Start the server and wait until it is available first, matching testWaitUntilUnavailableIsTimely.
|
Good catch. The test was creating the server in Fixed: the test now |
|
Code review by qodo was updated up to the latest commit 1a8240e |
|
I'd be great if you could respect the PR template. We do allow contributors to get AI help to shape the contributor, but then this looks as AI did the whole job. |
UrlChecker.waitUntilUnavailablecatchesInterruptedExceptionand rethrows it wrapped in aRuntimeExceptionwithout re-setting the thread's interrupt flag, so a caller can no longer tell the wait was interrupted. The siblingwaitUntilAvailablealready restores the flag in the same place, so this just makes the two consistent.The added test interrupts the calling thread while
waitUntilUnavailableis waiting and asserts the interrupt status is preserved.AI assistance disclosure
This contribution was produced with the help of an AI pipeline. The pipeline processed a large amount of source code to surface suspected bugs, reproduced a subset of them with failing unit tests and generated candidate fixes, and prepared pull requests from the ones that held up. Each PR was then reviewed and verified by a human before being opened: the fix and test were checked by hand and the test was confirmed to fail before the change and pass after.