From 917c1bb25baded302091dfd18d517b153c7ce487 Mon Sep 17 00:00:00 2001 From: bbailla2 Date: Wed, 3 Apr 2019 12:25:34 -0400 Subject: [PATCH] TII-256 - Log responses from Turnitin in the TurnitinOC Provider --- .../turnitin/oc/ContentReviewServiceTurnitinOC.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/content-review/impl/turnitin-oc/src/main/java/org/sakaiproject/contentreview/turnitin/oc/ContentReviewServiceTurnitinOC.java b/content-review/impl/turnitin-oc/src/main/java/org/sakaiproject/contentreview/turnitin/oc/ContentReviewServiceTurnitinOC.java index dffffa819030..6fabd7571b67 100644 --- a/content-review/impl/turnitin-oc/src/main/java/org/sakaiproject/contentreview/turnitin/oc/ContentReviewServiceTurnitinOC.java +++ b/content-review/impl/turnitin-oc/src/main/java/org/sakaiproject/contentreview/turnitin/oc/ContentReviewServiceTurnitinOC.java @@ -625,7 +625,18 @@ private HashMap makeHttpCall(String method, String urlStr, Map= 300) + { + // getInputStream() throws an exception in this case, but getErrorStream() has the information necessary for troubleshooting + responseBody = IOUtils.toString(connection.getErrorStream(), StandardCharsets.UTF_8); + log.warn("Turnitin response code: " + responseCode + "; message: " + responseMessage + "; body:\n" + responseBody); + } + else + { + responseBody = IOUtils.toString(connection.getInputStream(), StandardCharsets.UTF_8); + log.debug("Turnitin response code: " + responseCode + "; message: " + responseMessage + "; body:\n" + responseBody); + } HashMap response = new HashMap(); response.put(RESPONSE_CODE, responseCode);