Skip to content

NullPointerException on timeout in HttpComponentsClientHttpConnector when using Apache HttpComponents #30245

@bhardwick

Description

@bhardwick

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

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions