Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 11 HTTP client incorrectly reports 'invalid URI' exception message when cause is thread interruption #2191

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

gromspys
Copy link
Contributor

@gromspys gromspys commented Oct 2, 2023

Fixes #2188

Java 11 HTTP client incorrectly reports 'invalid URI' exception message when cause is thread interruption.
Example stacktrace:

Caused by: java.io.IOException: Invalid uri https://yourdomainhere.com/api/example?foo=bar
 	at feign.http2client.Http2Client.execute(Http2Client.java:102) ~[feign-java11-12.5.jar!/:?]
 	at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:100) ~[feign-core-12.5.jar!/:?]
 	at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:70) ~[feign-core-12.5.jar!/:?]
 	at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:96) ~[feign-core-12.5.jar!/:?]
 	... 9 more
 Caused by: java.lang.InterruptedException
 	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:386) ~[?:?]
 	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) ~[?:?]
 	at jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:553) ~[java.net.http:?]
 	at jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:123) ~[java.net.http:?]
 	at feign.http2client.Http2Client.execute(Http2Client.java:99) ~[feign-java11-12.5.jar!/:?]
 	at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:100) ~[feign-core-12.5.jar!/:?]
 	at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:70) ~[feign-core-12.5.jar!/:?]

Summary by CodeRabbit

  • Refactor: Simplified the exception handling in Http2Client.java. The execute method now throws the original InterruptedException without appending the URL. This change enhances the readability of error messages and focuses on the core issue, making it easier for developers to debug issues related to network interruptions.

@coderabbitai
Copy link

coderabbitai bot commented Oct 2, 2023

Walkthrough

The change in the execute method of the Http2Client.java class simplifies the exception message. Now, when an InterruptedException occurs, it only throws the original exception without appending the URL information.

Changes

File Summary
.../http2client/Http2Client.java Simplified the exception message in the execute method by removing the URL information from the IOException.

🐇💻

In the land of code, where exceptions roam,
A rabbit hopped and made a home.
He tweaked a line, then two, then three,
And simplified for all to see.
No more clutter, no more fuss,
Just clean code without a muss.
So here's to changes, big and small,
CodeRabbit celebrates them all! 🎉🥕


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.
  • Additionally, enter @coderabbitai pause to halt the bot's ongoing reviews as any issue or review comment. To
    resume reviews, enter @coderabbitai resume as any issue or review comment.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between c7aa85c and 901effb.
Files selected for processing (1)
  • java11/src/main/java/feign/http2client/Http2Client.java (1 hunks)
Files skipped from review due to trivial changes (1)
  • java11/src/main/java/feign/http2client/Http2Client.java

@velo velo merged commit e9b0765 into OpenFeign:master Oct 2, 2023
1 check passed
@gromspys gromspys deleted the update-exception-message branch October 2, 2023 10:31
velo pushed a commit that referenced this pull request Oct 7, 2024
velo pushed a commit that referenced this pull request Oct 8, 2024
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.

Java 11 HTTP client incorrectly reports 'invalid URI' exception message when cause is thread interruption
2 participants