jira-importer opened a new issue, #946: URL: https://github.com/apache/httpcomponents-core/issues/946
**[Bill Speirs](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=wspeirs)** opened **[HTTPCORE-302](https://issues.apache.org/jira/browse/HTTPCORE-302?redirect=false)** and commented The setEntity() method of HttpResponse makes it very easy to leak connections if used without consuming the old entity first. I'm proposing the following enhancements: 1) add a Javadoc note to the setEntity() method of HttpResponse that says something like: "Implementations might not consume an existing entity. Callers should consume any existing entity before calling this method." 2) either add a consumeAndSetEntity() method to BasicHttpResponse which consumes an existing entity before setting the reference, OR change the implementation of setEntity() to consume any existing entity first. (My vote is for the later, although it will change existing behavior, it shouldn't negatively impact any callers.) The reason for this improvement request is simply that I've been burned a few times by calling setEntity() without first consuming the existing entity, and I think we could make this more user friendly. I'm happy to submit a patch once we decide what should be done with `#2`. --- **Affects:** 4.2.1 **Attachments:** - [HTTPCORE-302.diff](https://issues.apache.org/jira/secure/attachment/12537594/HTTPCORE-302.diff) (_1.92 kB_) - [HTTPCORE-302v2.diff](https://issues.apache.org/jira/secure/attachment/12538004/HTTPCORE-302v2.diff) (_3.20 kB_) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
