File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
okhttp/src/main/kotlin/okhttp3/internal/platform/android Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ package okhttp3.internal.platform.android
17
17
18
18
import java.lang.reflect.InvocationTargetException
19
19
import java.lang.reflect.Method
20
- import java.nio.charset.StandardCharsets
21
20
import javax.net.ssl.SSLSocket
22
21
import okhttp3.Protocol
23
22
import okhttp3.internal.platform.AndroidPlatform
@@ -79,17 +78,16 @@ open class AndroidSocketAdapter(private val sslSocketClass: Class<in SSLSocket>)
79
78
80
79
return try {
81
80
val alpnResult = getAlpnSelectedProtocol.invoke(sslSocket) as ByteArray?
82
- if (alpnResult != null ) String (alpnResult, StandardCharsets .UTF_8 ) else null
83
- } catch (e: NullPointerException ) {
84
- when {
85
- // https://github.com/square/okhttp/issues/5587
86
- e.message == " ssl == null" -> null
87
- else -> throw e
88
- }
81
+ alpnResult?.toString(Charsets .UTF_8 )
89
82
} catch (e: IllegalAccessException ) {
90
83
throw AssertionError (e)
91
84
} catch (e: InvocationTargetException ) {
92
- throw AssertionError (e)
85
+ // https://github.com/square/okhttp/issues/5587
86
+ val cause = e.cause
87
+ when {
88
+ cause is NullPointerException && cause.message == " ssl == null" -> null
89
+ else -> throw AssertionError (e)
90
+ }
93
91
}
94
92
}
95
93
You can’t perform that action at this time.
0 commit comments