Skip to content

fix: Guard against null scheme in RedisStoreImplBase for relative URIs#185

Merged
tanderson-ld merged 2 commits into
launchdarkly:mainfrom
jsolferreira:fix/redis-store-npe-relative-uri
Jul 6, 2026
Merged

fix: Guard against null scheme in RedisStoreImplBase for relative URIs#185
tanderson-ld merged 2 commits into
launchdarkly:mainfrom
jsolferreira:fix/redis-store-npe-relative-uri

Conversation

@jsolferreira

@jsolferreira jsolferreira commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

URI.getScheme() returns null for scheme-less URIs such as //localhost:6379.
In RedisStoreImplBase, the TLS detection line:

boolean tls = builder.tls || builder.uri.getScheme().equals("rediss");

called .equals() on that null, throwing an NPE at store construction time.

Fixed by flipping to the null-safe form:

boolean tls = builder.tls || "rediss".equals(builder.uri.getScheme());

A scheme-less URI now correctly resolves TLS to false (unless explicitly set via .tls(true)).


Note

Low Risk
Single-line defensive null check with unchanged TLS semantics for valid redis/rediss URIs.

Overview
Fixes an NPE when constructing the Redis data store from a URI with no scheme (e.g. //localhost:6379).

TLS detection in RedisStoreImplBase used builder.uri.getScheme().equals("rediss"), which throws if getScheme() is null. It now uses "rediss".equals(builder.uri.getScheme()), so scheme-less URIs are treated as non-TLS unless builder.tls is set explicitly.

Reviewed by Cursor Bugbot for commit 666069a. Bugbot is set up for automated code reviews on this repo. Configure here.

@jsolferreira jsolferreira requested a review from a team as a code owner July 3, 2026 08:00

@tanderson-ld tanderson-ld left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@tanderson-ld tanderson-ld merged commit 74c697d into launchdarkly:main Jul 6, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants