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

NullPointerException on timeout in HttpComponentsClientHttpConnector when using Apache HttpComponents #30245

Closed
bhardwick opened this issue Mar 30, 2023 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@bhardwick
Copy link

bhardwick commented Mar 30, 2023

Receiving a NullPointerException on timeout in HttpComponentsClientHttpConnector when using Apache HttpComponents.

HttpComponents (core5) throws exceptions on timeout as follows:
stream.reset(new H2StreamResetException(H2Error.NO_ERROR, "Timeout due to inactivity (" + timeout + ")"));

Spring Web HttpComponentsClientHttpConnector handles it as follows;

Throwable t = (ex instanceof HttpStreamResetException hsre ? hsre.getCause() : ex);
this.sink.error(t);

Since hsre.getCause() is null, it produces a NullPointerException when handling upstream in the constructor of WebClientRequestException.

Solution: If HttpStreamResetException cause is null, the exception itself should be returned.

Spring version: 6.0.4
HttpComponents (core5) version: 5.1.5

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 30, 2023
@jhoeller jhoeller added in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug labels Mar 30, 2023
@jhoeller jhoeller added this to the 6.0.8 milestone Mar 30, 2023
@jhoeller jhoeller self-assigned this Mar 30, 2023
@jhoeller jhoeller added for: backport-to-5.3.x and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Mar 30, 2023
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.3.x labels Mar 30, 2023
jhoeller added a commit that referenced this issue Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants