Improve handling of SSLExceptions.

Current theory is that some Samsung devices a doing something funky with SSLExceptions, causing them to not be caught as IOExceptions.
fork-5.53.8
Greyson Parrelli 2022-09-23 10:37:32 -04:00 zatwierdzone przez Cody Henthorne
rodzic e67ac95890
commit 533dcfb828
1 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -7,6 +7,10 @@ import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import java.io.IOException;
import javax.net.ssl.SSLException;
import io.reactivex.rxjava3.exceptions.OnErrorNotImplementedException;
public class SignalUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
@ -21,6 +25,16 @@ public class SignalUncaughtExceptionHandler implements Thread.UncaughtExceptionH
@Override
public void uncaughtException(@NonNull Thread t, @NonNull Throwable e) {
// Seeing weird situations where SSLExceptions aren't being caught as IOExceptions
if (e instanceof SSLException) {
if (e instanceof IOException) {
Log.w(TAG, "Uncaught SSLException! It *is* an IOException!", e);
} else {
Log.w(TAG, "Uncaught SSLException! It is *not* an IOException!", e);
}
return;
}
if (e instanceof OnErrorNotImplementedException && e.getCause() != null) {
e = e.getCause();
}