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.
This commit is contained in:
parent
c59fc3581a
commit
eca67b1204
1 changed files with 5 additions and 1 deletions
|
@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import org.xbill.DNS.ARecord;
|
import org.xbill.DNS.ARecord;
|
||||||
import org.xbill.DNS.Lookup;
|
import org.xbill.DNS.Lookup;
|
||||||
import org.xbill.DNS.Record;
|
import org.xbill.DNS.Record;
|
||||||
|
@ -23,6 +24,8 @@ import okhttp3.Dns;
|
||||||
*/
|
*/
|
||||||
public class CustomDns implements Dns {
|
public class CustomDns implements Dns {
|
||||||
|
|
||||||
|
private static final String TAG = Log.tag(CustomDns.class);
|
||||||
|
|
||||||
private final String dnsHostname;
|
private final String dnsHostname;
|
||||||
|
|
||||||
public CustomDns(@NonNull 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 {
|
private static @NonNull Lookup doLookup(@NonNull String hostname) throws UnknownHostException {
|
||||||
try {
|
try {
|
||||||
return new Lookup(hostname);
|
return new Lookup(hostname);
|
||||||
} catch (TextParseException e) {
|
} catch (Throwable e) {
|
||||||
|
Log.w(TAG, e);
|
||||||
throw new UnknownHostException();
|
throw new UnknownHostException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue