Skip to content

Commit

Permalink
Handle UnsupportedOperationException – if the underlying provider doe…
Browse files Browse the repository at this point in the history
…s not implement the operation
  • Loading branch information
yschimke committed Dec 28, 2024
1 parent 61bd2e3 commit 35ffe79
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ open class Platform {
@IgnoreJRERequirement // This function is overridden to require API >= 24.
open fun getHandshakeServerNames(sslSocket: SSLSocket): List<String> {
val session = sslSocket.session as? ExtendedSSLSession ?: return listOf()
return session.requestedServerNames.mapNotNull { (it as? SNIHostName)?.asciiName }
return try {
session.requestedServerNames.mapNotNull { (it as? SNIHostName)?.asciiName }
} catch (uoe: UnsupportedOperationException) {
// UnsupportedOperationException – if the underlying provider does not implement the operation
// https://github.com/bcgit/bc-java/issues/1773
listOf()
}
}

@Throws(IOException::class)
Expand Down

0 comments on commit 35ffe79

Please sign in to comment.