Skip to content

Commit 73abf7f

Browse files
committed
Add nullability annotations to module/spring-boot-h2console
See gh-46587
1 parent a044d91 commit 73abf7f

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

module/spring-boot-h2console/src/main/java/org/springframework/boot/h2console/autoconfigure/H2ConsoleAutoConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.commons.logging.Log;
2626
import org.apache.commons.logging.LogFactory;
2727
import org.h2.server.web.JakartaWebServlet;
28+
import org.jspecify.annotations.Nullable;
2829

2930
import org.springframework.beans.factory.ObjectProvider;
3031
import org.springframework.boot.autoconfigure.AutoConfiguration;
@@ -118,7 +119,7 @@ private List<String> getConnectionUrls(ObjectProvider<DataSource> dataSources) {
118119
.toList();
119120
}
120121

121-
private String getConnectionUrl(DataSource dataSource) {
122+
private @Nullable String getConnectionUrl(DataSource dataSource) {
122123
try (Connection connection = dataSource.getConnection()) {
123124
return "'" + connection.getMetaData().getURL() + "'";
124125
}

module/spring-boot-h2console/src/main/java/org/springframework/boot/h2console/autoconfigure/H2ConsoleProperties.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.h2console.autoconfigure;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.boot.context.properties.ConfigurationProperties;
2022
import org.springframework.util.Assert;
2123

@@ -80,7 +82,7 @@ public static class Settings {
8082
/**
8183
* Password to access preferences and tools of H2 Console.
8284
*/
83-
private String webAdminPassword;
85+
private @Nullable String webAdminPassword;
8486

8587
public boolean isTrace() {
8688
return this.trace;
@@ -98,11 +100,11 @@ public void setWebAllowOthers(boolean webAllowOthers) {
98100
this.webAllowOthers = webAllowOthers;
99101
}
100102

101-
public String getWebAdminPassword() {
103+
public @Nullable String getWebAdminPassword() {
102104
return this.webAdminPassword;
103105
}
104106

105-
public void setWebAdminPassword(String webAdminPassword) {
107+
public void setWebAdminPassword(@Nullable String webAdminPassword) {
106108
this.webAdminPassword = webAdminPassword;
107109
}
108110

module/spring-boot-h2console/src/main/java/org/springframework/boot/h2console/autoconfigure/package-info.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
/**
1818
* Auto-configuration for H2's Console.
1919
*/
20+
@NullMarked
2021
package org.springframework.boot.h2console.autoconfigure;
22+
23+
import org.jspecify.annotations.NullMarked;

0 commit comments

Comments
 (0)