mirror of https://github.com/apache/jclouds.git
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:
parent
b858ec002e
commit
ec11f2ef20
|
@ -37,14 +37,14 @@ import org.jclouds.util.Utils;
|
||||||
*/
|
*/
|
||||||
public class CloseContentAndSetExceptionHandler implements HttpResponseHandler {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue