Browse files

bug20272: NPE when no response stream is available

<release-note>
bug20272: NPE when no response stream is available

Previously, the Java client's HTTP response handler could throw an
opaque NullPointerExeption if no response stream is available (this
might occur due to a server crash).  With this change, the response
handler checks for a null stream and throws an exception advising
the user that no response stream is available and to inspect the
server log file for possible explanations.
</release-note>

make prepush passes

Change-Id: Ie29cae3ad0b0069ec55d53290bc4c30961e4b1b4
Reviewed-on: https://gerrit.franz.com:9080/1610
Reviewed-by: John O'Rourke <jor@franz.com>
Reviewed-by: Ahmon Dancy <dancy@franz.com>
Tested-by: Kevin Layer <layer@franz.com>
  • Loading branch information...
1 parent 501b086 commit eb3ad7045cf40a0293091eb91215081f3f9d410b Bill Millar committed with dklayer Aug 22, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/com/franz/agraph/http/AGResponseHandler.java
View
3 src/com/franz/agraph/http/AGResponseHandler.java
@@ -240,6 +240,9 @@ protected String getResponseMIMEType(HttpMethod method) throws IOException {
protected static InputStream getInputStream(HttpMethod method) throws IOException {
InputStream is = method.getResponseBodyAsStream();
+ if (is==null) {
+ throw new IOException("Response input stream not available; this could indicate a server problem. Please check server logs.");
+ }
Header h = method.getResponseHeader("Content-Encoding");
if (h!=null && h.getValue().equals("gzip")) {
is = new GZIPInputStream(is);

0 comments on commit eb3ad70

Please sign in to comment.