-
Bug
-
Resolution: Done
-
Major
-
3.1.4.Final
-
None
We are using OpenStack4j with resteasy-jaxrs. Today I debugged a NullPointerException that was thrown when processing a 404 response with http-headers "Content-Type: application/json" and "Content-Length: 238".
I traced through the Resteasy code and found the root cause to be within resteasy. This is how the issue occurs:
- the input stream is null here, RestEasy attempts to build a ClientResponseFailure object https://github.com/resteasy/Resteasy/blob/master/resteasy-legacy/src/main/java/org/jboss/resteasy/client/core/BaseClientResponse.java#L435
- this calls https://github.com/resteasy/Resteasy/blob/master/resteasy-legacy/src/main/java/org/jboss/resteasy/client/ClientResponseFailure.java#L32
- which in turn calls https://github.com/resteasy/Resteasy/blob/master/resteasy-legacy/src/main/java/org/jboss/resteasy/client/core/BaseClientResponse.java#L110
However,
ReadFromStream.readFromStream(1024, is);
does not handle is == null, hence the exception. The surrounding try block also only catches IOException .