Skip to content

Handle null return from ExtendedSSLSession.getRequestedServerNames on Android SDK 27/28 - #9525

Open
tsushanth wants to merge 1 commit into
lysine-dev:mainfrom
tsushanth:fix/9523-requested-server-names-null
Open

Handle null return from ExtendedSSLSession.getRequestedServerNames on Android SDK 27/28#9525
tsushanth wants to merge 1 commit into
lysine-dev:mainfrom
tsushanth:fix/9523-requested-server-names-null

Conversation

@tsushanth

Copy link
Copy Markdown

Fixes #9523.

On Android SDK 27 and 28, ExtendedSSLSession.getRequestedServerNames() can return null instead of an empty list (upstream bug: google/conscrypt#977). This causes a NullPointerException in MockWebServer when recording requestedServerNames on a RecordedRequest.

Change: one-line null guard in Platform.getHandshakeServerNames — replace direct .mapNotNull call with (session.requestedServerNames ?: emptyList()).mapNotNull { ... }. Already catches UnsupportedOperationException in the same block, so the null case fits the same defensive pattern.

On Android SDK 27/28, getRequestedServerNames() can return null instead
of an empty list (see google/conscrypt#977). Guard with ?: emptyList() so
MockWebServer no longer throws NPE on affected emulator versions.

Fixes lysine-dev#9523
@tsushanth

Copy link
Copy Markdown
Author

The two CI failures appear to be pre-existing flakiness unrelated to this change:

  • jvm (11): FastFallbackTest > preferCallConnectionOverDeferredConnection failed with an IPv4/IPv6 connection-ordering race — the test asserts one connection type was preferred over another in a timing-sensitive scenario. The same job passes on main and the PR only touches Platform.kt (the null-check for getRequestedServerNames), which is on an entirely different code path.
  • android (37.0, playstore_ps16k): also passes on main at head.

Happy to re-run CI if the maintainer can trigger it, or I can rebase onto a fresh main commit to get a clean run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Unhandled null return from ExtendedSSLSession.getRequestedServerNames

2 participants