From eca67b12042f5e580fb9595d189e97142f4454a6 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Mon, 4 May 2020 09:07:46 -0400 Subject: [PATCH] Broaden exception handling in custom DNS. A set of LG devices is crashing when using the custom DNS. Safest thing for now would be to treat all failures as network errors while we we try to get a repro to figure out what's happening. --- .../main/java/org/thoughtcrime/securesms/net/CustomDns.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/net/CustomDns.java b/app/src/main/java/org/thoughtcrime/securesms/net/CustomDns.java index d025fba212..bd6576c5c9 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/net/CustomDns.java +++ b/app/src/main/java/org/thoughtcrime/securesms/net/CustomDns.java @@ -4,6 +4,7 @@ import androidx.annotation.NonNull; import com.annimon.stream.Stream; +import org.thoughtcrime.securesms.logging.Log; import org.xbill.DNS.ARecord; import org.xbill.DNS.Lookup; import org.xbill.DNS.Record; @@ -23,6 +24,8 @@ import okhttp3.Dns; */ public class CustomDns implements Dns { + private static final String TAG = Log.tag(CustomDns.class); + private final String dnsHostname; public CustomDns(@NonNull String dnsHostname) { @@ -55,7 +58,8 @@ public class CustomDns implements Dns { private static @NonNull Lookup doLookup(@NonNull String hostname) throws UnknownHostException { try { return new Lookup(hostname); - } catch (TextParseException e) { + } catch (Throwable e) { + Log.w(TAG, e); throw new UnknownHostException(); } }