GitHub user ansell opened a pull request:
https://github.com/apache/httpclient/pull/61
HTTPCLIENT-1767: Null pointer dereference in EofSensorInputStream and
ResponseEntityProxy
This fixes HTTPCLIENT-1767 by adding null checks to ResponseEntityProxy and
dereferencing instance variables before null checks in EofSensorInputStream.
For reference here, the stacktrace, against httpclient-4.5.2, which I can't
reproduce reliably, but which should be fixed by these changes is:
```
java.lang.NullPointerException: null
at
org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:140)
at
org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)
at
org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:174)
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ansell/httpclient HTTPCLIENT-1767
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/httpclient/pull/61.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #61
----
commit 56b37dfdab78d651f95f7825b1c0f7daa166e8c5
Author: Peter Ansell <[email protected]>
Date: 2016-09-13T01:05:21Z
HTTPCLIENT-1767: Fix null pointer dereference after guard
EofSensorInputStream is generating NullPointerExceptions in some rare
situations. This commit fixes that behaviour for the check methods by
dereferencing the instance variable to a final local variable to ensure that if
it is not null at the null guard, that it will be not null after that point
also to successfully close/abort the stream
Signed-off-by: Peter Ansell <[email protected]>
commit b4a82de6a65fabc1cbbb57988fce046dd87b7e1e
Author: Peter Ansell <[email protected]>
Date: 2016-09-13T01:09:37Z
HTTPCLIENT-1767: Check parameters for null in ResponseEntityProxy
In some rare cases, null parameters are sent to ReponseEntityProxy methods,
this adds checks on those to ensure that the connections are still released,
but the null variable is not dereferenced.
Signed-off-by: Peter Ansell <[email protected]>
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]