check null before attempting to close a stream

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1440 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-06-17 23:00:22 +00:00
parent b858ec002e
commit ec11f2ef20
1 changed files with 10 additions and 10 deletions

View File

@ -40,9 +40,9 @@ public class CloseContentAndSetExceptionHandler implements HttpResponseHandler {
public void handle(HttpFutureCommand<?> command, HttpResponse response) { public void handle(HttpFutureCommand<?> command, HttpResponse response) {
String content; String content;
try { try {
content = Utils.toStringAndClose(response.getContent()); content = response.getContent() != null ? Utils.toStringAndClose(response.getContent())
command.setException(new HttpResponseException(command, response, : null;
content)); command.setException(new HttpResponseException(command, response, content));
} catch (IOException e) { } catch (IOException e) {
command.setException(new HttpResponseException(command, response)); command.setException(new HttpResponseException(command, response));
} }