profile
viewpoint

Ask questionsOkHttp 3.x fails with OpenJDK Zulu 8.0.252

Hi folks,

We found that this particular piece of code in okhttp 3.x: https://github.com/square/okhttp/blob/okhttp_3.14.x/okhttp/src/main/java/okhttp3/internal/platform/Jdk9Platform.java#L81-L94 breaks.

This checks for setApplicationProtocols and getApplicationProtocol which are JDK 9. however, these ones got backported to Zulu 8.0.252 causing OkHttp believing that is running on jdk9 and initializing a Jdk9Platform which breaks projects

Wondering if a patch could be released for 3.x since there are several libraries and projects out there that haven't migrated to 4.x

Thanks

square/okhttp

Answer questions DanielThomas

Looks great! JDK 9 platform activates and the fallback for UnsupportedOperationException for our incompatible SslSocket wrapper successfully falls back to HTTP/1.

useful!

Related questions

OkHttp3 - IOException: unexpected end of stream on okhttp3.Address@9d7c59b5 hot 3
4.0.0-alpha02 ProGuard issues hot 2
new OkhttpClient() crash on android 4.4 hot 2
javax.net.ssl.SSLHandshakeException: Chain validation failed hot 2
okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR/ CANCEL hot 1
java.io.EOFException: \n not found: limit=0 content=… hot 1
Tomcat is not able to stop because of "OkHttp ConnectionPool" and "Okio Watchdog" threads hot 1
okhttp fails with IOException: gzip finished without exhausting source but GZIPInputStream works hot 1
R8 NullPointerException with OkHttp 3.13.1 hot 1
Android cleaning fails with custom trust manager and logging hot 1
okhttp 4.3.0 crash with custom X509TrustManager hot 1
ExceptionInitializerError with new Android 11 version (DP1) - okhttp hot 1
Version 3.10.0 error using Proguard on Android Studio hot 1
Docs should explain benefits of pinning both CA and host certificates hot 1
java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found hot 1
Github User Rank List