> +import org.jclouds.http.HttpResponse;
> +import org.jclouds.http.HttpResponseException;
> +import org.jclouds.rest.AuthorizationException;
> +
> +import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
> +
> +public class MarconiErrorHandler implements HttpErrorHandler {
> +
> + public void handleError(HttpCommand command, HttpResponse response) {
> + // it is important to always read fully and close streams
> + byte[] data = closeClientButKeepContentStream(response);
> + String message = (data != null) ? new String(data) : null;
> +
> + Exception exception = (message != null) ?
> + new HttpResponseException(command, response, message) :
> + new HttpResponseException(command, response);
[minor] Rather than the two hidden "ifs", how about
```
if (data == null) {
Exception exception = new HttpResponseException(command, response);
} else {
new HttpResponseException(command, response, new String(data));
}
```
?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/42/files#r7051055