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 void handle(HttpFutureCommand<?> command, HttpResponse response) {
|
||||
String content;
|
||||
try {
|
||||
content = Utils.toStringAndClose(response.getContent());
|
||||
command.setException(new HttpResponseException(command, response,
|
||||
content));
|
||||
} catch (IOException e) {
|
||||
command.setException(new HttpResponseException(command, response));
|
||||
}
|
||||
}
|
||||
public void handle(HttpFutureCommand<?> command, HttpResponse response) {
|
||||
String content;
|
||||
try {
|
||||
content = response.getContent() != null ? Utils.toStringAndClose(response.getContent())
|
||||
: null;
|
||||
command.setException(new HttpResponseException(command, response, content));
|
||||
} catch (IOException e) {
|
||||
command.setException(new HttpResponseException(command, response));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue