Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

import org.apache.commons.io.IOUtils;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import com.github.dockerjava.api.exception.BadRequestException;
import com.github.dockerjava.api.exception.ConflictException;
import com.github.dockerjava.api.exception.DockerException;
Expand Down Expand Up @@ -55,7 +58,7 @@ public void filter(ClientRequestContext requestContext, ClientResponseContext re
}
}

private String getBodyAsMessage(ClientResponseContext responseContext) throws IOException {
private String getBodyAsMessage(ClientResponseContext responseContext) {
if (responseContext.hasEntity()) {
try (InputStream entityStream = responseContext.getEntityStream()) {
Charset charset = null;
Expand All @@ -73,7 +76,17 @@ private String getBodyAsMessage(ClientResponseContext responseContext) throws IO
charset = Charset.defaultCharset();
}

return IOUtils.toString(entityStream, charset);
String message = IOUtils.toString(entityStream, charset);

if (MediaType.APPLICATION_JSON_TYPE.equals(mediaType)) {
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(entityStream).get("message");
if (node != null) {
message = node.textValue();
}
}

return message;
} catch (Exception ignored) { }
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void loadImageFromTar() throws Exception {
dockerRule.getClient().loadImageCmd(uploadStream).exec();
}

//swarm needs some time to refelct new images
//swarm needs some time to reflect new images
synchronized (this) {
wait(5000);
}
Expand Down