Skip to content

Commit

Permalink
Handle strict module handling on JDK17 (#6707)
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke committed Jul 4, 2021
1 parent ef7699f commit 134e041
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions okhttp/src/main/kotlin/okhttp3/internal/platform/Platform.kt
Expand Up @@ -94,6 +94,14 @@ open class Platform {
val context = readFieldOrNull(sslSocketFactory, sslContextClass, "context") ?: return null
readFieldOrNull(context, X509TrustManager::class.java, "trustManager")
} catch (e: ClassNotFoundException) {
null
} catch (e: RuntimeException) {
// Throws InaccessibleObjectException (added in JDK9) on JDK 17 due to
// JEP 403 Strongly Encapsulate JDK Internals.
if (e.javaClass.name != "java.lang.reflect.InaccessibleObjectException") {
throw e
}

null
}
}
Expand Down

0 comments on commit 134e041

Please sign in to comment.