1
0
mirror of https://github.com/etesync/android synced 2024-12-23 15:18:14 +00:00

Basemanager: consider SSLProtocolExceptions as real issues.

Kind of brings back what 1bbf00c6bd removed.
This commit is contained in:
Tom Hacohen 2019-09-12 00:18:03 +01:00
parent c26c2c5332
commit 67b6dce44f

View File

@ -7,6 +7,8 @@ import java.io.ByteArrayOutputStream
import java.io.IOException import java.io.IOException
import java.net.HttpURLConnection import java.net.HttpURLConnection
import java.util.logging.Level import java.util.logging.Level
import javax.net.ssl.SSLHandshakeException
import javax.net.ssl.SSLProtocolException
abstract class BaseManager { abstract class BaseManager {
@ -20,6 +22,11 @@ abstract class BaseManager {
Logger.log.fine("Making request for ${request.url()}") Logger.log.fine("Making request for ${request.url()}")
response = client!!.newCall(request).execute() response = client!!.newCall(request).execute()
} catch (e: IOException) { } catch (e: IOException) {
if (e is SSLProtocolException) {
throw e
} else if (e is SSLHandshakeException && e.cause is SSLProtocolException) {
throw e
}
Logger.log.log(Level.SEVERE, "Failed while connecting to server", e) Logger.log.log(Level.SEVERE, "Failed while connecting to server", e)
throw Exceptions.ServiceUnavailableException("[" + e.javaClass.name + "] " + e.localizedMessage) throw Exceptions.ServiceUnavailableException("[" + e.javaClass.name + "] " + e.localizedMessage)
} }