Skip to content

Remove redundant assertion in EncryptionOptions constructor - #5242

Open
kdomo wants to merge 1 commit into
spring-projects:mainfrom
kdomo:fix-redundant-encryptionoptions-assertion
Open

kdomo wants to merge 1 commit into
spring-projects:mainfrom
kdomo:fix-redundant-encryptionoptions-assertion

Conversation

@kdomo

@kdomo kdomo commented Sep 10, 2026

Copy link
Copy Markdown

The three-argument EncryptionOptions constructor asserts key twice:

Assert.hasText(algorithm, "Algorithm must not be empty");
Assert.notNull(key, "EncryptionKey must not be empty");
Assert.notNull(key, "QueryableEncryptionOptions must not be empty");

The third assertion re-checks key while its message names queryableEncryptionOptions. That parameter is @Nullable and the two-argument constructor passes null for it, so it must not be validated. The assertion is both redundant and misleading, so this removes it.

Closes #5241

The three-argument constructor asserted `key` twice. The second check
used the message "QueryableEncryptionOptions must not be empty", but
`queryableEncryptionOptions` is `@Nullable` and the two-argument
constructor passes `null` for it, so it must not be validated. The
assertion is therefore both redundant (re-checking `key`) and
misleading, so remove it.

Closes spring-projects#5241

Signed-off-by: kdomo <dongho5088@naver.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redundant assertion in EncryptionOptions constructor

2 participants