Skip to content

fix: catch only expected IO failures - #2207

Open
efegokdemir wants to merge 2 commits into
apache:masterfrom
efegokdemir:efe/fix-jetty-expected-io
Open

efegokdemir wants to merge 2 commits into
apache:masterfrom
efegokdemir:efe/fix-jetty-expected-io

Conversation

@efegokdemir

@efegokdemir efegokdemir commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1988.

PutTaskRequestContent.read() and rewind() now convert only IOException into terminal content failures. Unexpected runtime exceptions propagate to the caller instead of being hidden as ordinary content failures. Regression tests cover both channel paths.

Tests: focused Maven reactor verification passed with JDK 21; 105 Jetty tests passed and 10 were skipped. Spotless check passed with JDK 21.

  • I hereby declare this contribution to be licensed under the Apache License Version 2.0, January 2004
  • I hereby declare that I have filed an Apache Individual Contributor License Agreement.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

REQUEST_CHANGES

The catch (Exception e) → catch (IOException e) narrowing in read() is the right fix: unexpected RuntimeExceptions should propagate to the caller rather than being silently swallowed as content failures.

However, the same narrowing applied to rewind() exposes a pre-existing control-flow bug that this PR leaves unaddressed:

After the catch block on line 298, execution falls through to return true at line 302 regardless of whether the catch was taken. So when an IOException is caught and lockedSetTerminal(...) marks the stream as terminally failed, the method still returns true — telling Jetty's retry logic that the rewind succeeded. The subsequent retry then reads from a broken, terminated channel instead of bailing out.

The fix: add return false; inside the catch block, or restructure so the method returns false on any failure path.


License checkbox: The Apache License declaration checkbox is unchecked in the PR description. Please tick it before merge.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after latest commits. Both prior findings are addressed:

  • The rewind() fall-through return true bug is fixed — return false is now correctly placed inside the catch block, preventing a false success signal when an exception occurs.
  • Exception narrowing from Exception to IOException in both read() and rewind() is appropriate and correct.

⚠️ Reminder: The Apache License checkbox in the PR description is still unchecked — please tick it before merge.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Catching Throwable in non-framework code in PutTaskRequestContent

2 participants