Skip to content

Commit

Permalink
Use guava to read InputStream
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Oct 12, 2023
1 parent 28bab89 commit 9ceeb81
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9ceeb81

Please sign in to comment.