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.
master
Greyson Parrelli 2020-05-04 09:07:46 -04:00
parent c59fc3581a
commit eca67b1204
1 changed files with 5 additions and 1 deletions

View File

@ -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();
}
}