Skip to content

Commit 90952a2

Browse files
committed
Do not turn a null Flyway-specific password into an empty string
It prevents using PGPASS for authentication with Postgres. Fixes gh-35110
1 parent be698cf commit 90952a2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -601,7 +601,7 @@ public void setUser(String user) {
601601
}
602602

603603
public String getPassword() {
604-
return (this.password != null) ? this.password : "";
604+
return this.password;
605605
}
606606

607607
public void setPassword(String password) {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void createDataSourceDoesNotFallbackToEmbeddedProperties() {
154154
DataSource dataSource = context.getBean(Flyway.class).getConfiguration().getDataSource();
155155
assertThat(dataSource).isNotNull();
156156
assertThat(dataSource).hasFieldOrPropertyWithValue("username", null);
157-
assertThat(dataSource).hasFieldOrPropertyWithValue("password", "");
157+
assertThat(dataSource).hasFieldOrPropertyWithValue("password", null);
158158
});
159159
}
160160

0 commit comments

Comments
 (0)