From fb9696d538046a823d8f42260b984b583302410d Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 23 Feb 2023 19:13:06 +0100 Subject: [PATCH] Allow http for LanguageTool (2) --- .../main/java/eu/faircode/email/LanguageTool.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/LanguageTool.java b/app/src/main/java/eu/faircode/email/LanguageTool.java index b7d5c04ac9..fefab0a14c 100644 --- a/app/src/main/java/eu/faircode/email/LanguageTool.java +++ b/app/src/main/java/eu/faircode/email/LanguageTool.java @@ -50,8 +50,6 @@ import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.net.ssl.HttpsURLConnection; - public class LanguageTool { static final String LT_URI = "https://api.languagetool.org/v2/"; static final String LT_URI_PLUS = "https://api.languagetoolplus.com/v2/"; @@ -82,7 +80,7 @@ public class LanguageTool { Log.i("LT uri=" + uri); URL url = new URL(uri.toString()); - HttpURLConnection connection = (HttpsURLConnection) url.openConnection(); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(false); connection.setReadTimeout(LT_TIMEOUT * 1000); @@ -243,7 +241,7 @@ public class LanguageTool { Log.i("LT uri=" + uri + " request=" + request); URL url = new URL(uri.toString()); - HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setReadTimeout(LT_TIMEOUT * 1000); @@ -319,7 +317,7 @@ public class LanguageTool { Log.i("LT uri=" + uri + " request=" + request); URL url = new URL(uri.toString()); - HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setReadTimeout(LT_TIMEOUT * 1000); @@ -370,7 +368,7 @@ public class LanguageTool { Log.i("LT uri=" + uri); URL url = new URL(uri.toString()); - HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(false); connection.setReadTimeout(LT_TIMEOUT * 1000); @@ -436,7 +434,7 @@ public class LanguageTool { private static void checkStatus(HttpURLConnection connection) throws IOException { int status = connection.getResponseCode(); - if (status != HttpsURLConnection.HTTP_OK) { + if (status != HttpURLConnection.HTTP_OK) { String error = "Error " + status + ": " + connection.getResponseMessage(); try { InputStream is = connection.getErrorStream();