From 05cc02dca696f3c37578ee4a423dd99348c84a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20K=C3=B6rber?= Date: Wed, 22 Jun 2016 00:47:48 +0200 Subject: [PATCH] Fixed missing JSON debug output --- .../org/shredzone/acme4j/impl/DefaultConnection.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/acme4j-client/src/main/java/org/shredzone/acme4j/impl/DefaultConnection.java b/acme4j-client/src/main/java/org/shredzone/acme4j/impl/DefaultConnection.java index 46c59b60..6fbde1b2 100644 --- a/acme4j-client/src/main/java/org/shredzone/acme4j/impl/DefaultConnection.java +++ b/acme4j-client/src/main/java/org/shredzone/acme4j/impl/DefaultConnection.java @@ -173,20 +173,18 @@ public class DefaultConnection implements Connection { throw new AcmeProtocolException("Unexpected content type: " + contentType); } - StringBuilder sb = new StringBuilder(); Map result = null; + String response = ""; try { InputStream in = (conn.getResponseCode() < 400 ? conn.getInputStream() : conn.getErrorStream()); if (in != null) { - String response = readStream(in); - + response = readStream(in); result = JsonUtil.parseJson(response); - LOG.debug("Result JSON: {}", sb); + LOG.debug("Result JSON: {}", response); } - } catch (JoseException ex) { - throw new AcmeProtocolException("Failed to parse response: " + sb, ex); + throw new AcmeProtocolException("Failed to parse response: " + response, ex); } return result; @@ -199,7 +197,7 @@ public class DefaultConnection implements Connection { String line = reader.readLine(); while (line != null) { - sb.append(line); + sb.append(line.trim()); line = reader.readLine(); } }