Fix error handling in DefaultDockerClient
Sometimes the response input stream is closed. Reading from it
will throw IllegalStateException.
@@ -2110,7 +2110,13 @@ public class DefaultDockerClient implements DockerClient, Closeable {
}
private String message(final Response response) {
- final Readable reader = new InputStreamReader(response.readEntity(InputStream.class), UTF_8);
+ final Readable reader;
+ try {
+ reader = new InputStreamReader(response.readEntity(InputStream.class), UTF_8);
+ } catch (IllegalStateException e) {
+ return null;
+ }
+
try {
return CharStreams.toString(reader);
} catch (IOException ignore) {
