From e2bfbc0ab2bdfce464e5710f6a8f1cfe871b76cf Mon Sep 17 00:00:00 2001 From: stom79 Date: Sat, 15 Sep 2018 14:05:21 +0200 Subject: [PATCH] Fix potential crashes --- .../gouv/etalab/mastodon/client/HttpsConnection.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/HttpsConnection.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/HttpsConnection.java index e18da8a3f..da871ca97 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/client/HttpsConnection.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/HttpsConnection.java @@ -1646,15 +1646,11 @@ public class HttpsConnection { } private String converToString(InputStream inputStream) throws IOException { - BufferedReader r = new BufferedReader(new InputStreamReader(inputStream)); - StringBuilder total = new StringBuilder(inputStream.available()); - String line; - while ((line = r.readLine()) != null) { - total.append(line).append('\n'); - } - return total.toString(); + java.util.Scanner s = new java.util.Scanner(inputStream).useDelimiter("\\A"); + return s.hasNext() ? s.next() : ""; } + int getActionCode() { if( Helper.getLiveInstanceWithProtocol(context).startsWith("https://")) { try {