eclipse-ee4j / eclipse-ee4j/jersey

ApacheConnector close() throws exception if body not consumed

Open
#3,354 3 comments 0 reactions 0 assignees View on GitHub
Component: connectors Priority: Major Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

Works with jersey-apache-connector 2.21.1

```
public static void main(String... args) {
ClientConfig clientConfig = new ClientConfig().connectorProvider(new ApacheConnectorProvider());
Client client = ClientBuilder.newClient(clientConfig);
Response response = client.target("http://www.apache.org/").request(TEXT_HTML_TYPE).get();
out.printf("Status: %d%n", response.getStatus());
// uncomment to make test pass
// response.readEntity(String.class);
response.close();
}
```
#### Affected Versions
[2.22.2]

Contributor guide

Open the contributing guide

Research direction

Run the provided Java example with jersey-apache-connector 2.21.1 and the affected 2.22.2 version, comparing response.close() with and without response.readEntity(String.class). Trace the ApacheConnector close path to identify why an unconsumed body causes an exception, then verify that closing the response works without consuming the body.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.