From 9ceeb8185e9d20ff3420e46a286344d5ffbafd5d Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Thu, 12 Oct 2023 13:46:40 -0400 Subject: [PATCH] Use guava to read InputStream Signed-off-by: Craig Perkins --- .../opensearch/security/test/helper/rest/RestHelper.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/opensearch/security/test/helper/rest/RestHelper.java b/src/test/java/org/opensearch/security/test/helper/rest/RestHelper.java index 5fad23ed17..4260af23fc 100644 --- a/src/test/java/org/opensearch/security/test/helper/rest/RestHelper.java +++ b/src/test/java/org/opensearch/security/test/helper/rest/RestHelper.java @@ -28,6 +28,7 @@ import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.security.KeyStore; @@ -45,7 +46,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; -import org.apache.commons.io.IOUtils; +import com.google.common.base.Charsets; +import com.google.common.io.CharStreams; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpHeaders; @@ -117,7 +119,7 @@ public String executeSimpleRequest(final String request) throws Exception { throw new Exception("Statuscode " + response.getStatusLine().getStatusCode()); } - return IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); + return CharStreams.toString(new InputStreamReader(response.getEntity().getContent(), Charsets.UTF_8)); } finally { if (response != null) {