Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException at SingleHostConnectionFunction#getCredentials when configuration password is null #622

Closed
janainamendonca opened this issue Dec 27, 2023 · 0 comments
Labels
type: regression A regression from a previous release
Milestone

Comments

@janainamendonca
Copy link

Bug Report

This is a regression from #613

Versions

  • Driver: 1.0.3.RELEASE
  • Database: CockroachDB
  • Java: 21
  • OS: macOS 14.1.2

Current Behavior

The PostgresqlConnectionConfiguration.Builder allows to build a configuration where the password field is null (instead of an empty publisher), it blows up when SingleHostConnectionFunction#getCredentials is called as it tries to create a Mono with null value.

Stack trace
Caused by: java.lang.NullPointerException: publisher
	at java.base/java.util.Objects.requireNonNull(Objects.java:259)
	at reactor.core.publisher.MonoFromPublisher.<init>(MonoFromPublisher.java:44)
	at reactor.core.publisher.Mono.wrap(Mono.java:5383)
	at reactor.core.publisher.Mono.from(Mono.java:507)
	at io.r2dbc.postgresql.SingleHostConnectionFunction.getCredentials(SingleHostConnectionFunction.java:72)
	at io.r2dbc.postgresql.SingleHostConnectionFunction.lambda$connect$2(SingleHostConnectionFunction.java:48)
	at reactor.core.publisher.MonoDelayUntil$DelayUntilCoordinator.subscribeNextTrigger(MonoDelayUntil.java:293)
	... 29 common frames omitted

Expected behavior/code

To not fail if a password is not set to the builder given that the field used to be nullable and the change from #613 changed the behaviour making it not compatible with existing code from SpringBoot.

Possible Solution

The builder could assign a default value (Mono.empty()) to the password field

@janainamendonca janainamendonca added the status: waiting-for-triage An issue we've not yet triaged label Dec 27, 2023
@mp911de mp911de added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 28, 2023
@mp911de mp911de added this to the 1.0.4.RELEASE milestone Dec 28, 2023
@mp911de mp911de changed the title NullPointerException at SingleHostConnectionFunction#getCredentials when configuration password is null (regression from #613) NullPointerException at SingleHostConnectionFunction#getCredentials when configuration password is null Dec 28, 2023
mp911de added a commit that referenced this issue Dec 28, 2023
[#622]

Signed-off-by: Mark Paluch <mpaluch@paluch.biz>
mp911de added a commit that referenced this issue Dec 28, 2023
[#622]

Signed-off-by: Mark Paluch <mpaluch@paluch.biz>
@mp911de mp911de closed this as completed Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

2 participants