aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorBogdana <bogdana.kushnir@sonarsource.com>2024-08-22 15:53:55 +0200
committersonartech <sonartech@sonarsource.com>2024-08-23 20:02:33 +0000
commita5b6cf1c23b872b82a09dbedade8f0ce78af5345 (patch)
treeba8f75b9ffb45f6fe2af5bcb5278bc9c23602642 /server
parent52f852bcba57febc5f49e0c51dcc0ccbb100aa02 (diff)
downloadsonarqube-a5b6cf1c23b872b82a09dbedade8f0ce78af5345.tar.gz
sonarqube-a5b6cf1c23b872b82a09dbedade8f0ce78af5345.zip
SGB-123 cover null value case for email.smtp_secure_connection.secured
Diffstat (limited to 'server')
-rw-r--r--server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfigurationIT.java3
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfiguration.java2
2 files changed, 3 insertions, 2 deletions
diff --git a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfigurationIT.java b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfigurationIT.java
index f40b7a22fc7..efcd150bc41 100644
--- a/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfigurationIT.java
+++ b/server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfigurationIT.java
@@ -165,6 +165,7 @@ class MigrateSmtpConfigurationIT {
return new Object[][]{
{"ssl", "SSLTLS"},
{"starttls", "STARTTLS"},
+ {null, "NONE"},
{"", "NONE"},
{"null", "NONE"},
{"random", "NONE"}
@@ -280,4 +281,4 @@ class MigrateSmtpConfigurationIT {
db.executeInsert("internal_properties", "kee", key, "is_empty", false, "text_value", value, "created_at", 0);
}
-} \ No newline at end of file
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfiguration.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfiguration.java
index 7eb56e75d9d..0ec5bbbba93 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfiguration.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v107/MigrateSmtpConfiguration.java
@@ -138,7 +138,7 @@ public class MigrateSmtpConfiguration extends DataChange {
}
private static PropertyDb getSecureConnectionWithNewValues(PropertyDb currentProperty) {
- String newValue = switch (currentProperty.value) {
+ String newValue = switch (currentProperty.value == null ? "" : currentProperty.value) {
case "ssl" -> "SSLTLS";
case "starttls" -> "STARTTLS";
default -> "NONE";