Update DatabaseService.java

This commit is contained in:
Ludy 2025-05-02 00:15:47 +02:00 committed by GitHub
parent d95f169ebd
commit 7fae826f9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -246,15 +246,16 @@ public class DatabaseService implements DatabaseInterface {
boolean isDBUrlH2 = boolean isDBUrlH2 =
datasource.getCustomDatabaseUrl().contains("h2") datasource.getCustomDatabaseUrl().contains("h2")
|| datasource.getCustomDatabaseUrl().contains("H2"); || datasource.getCustomDatabaseUrl().contains("H2");
boolean isCustomDatabase = datasource.isEnableCustomDatabase();
if (isTypeH2 && !isDBUrlH2) { if (isTypeH2 && !isDBUrlH2 && isCustomDatabase) {
log.warn( log.warn(
"Datasource type is H2, but the URL does not contain 'h2'. " "Datasource type is H2, but the URL does not contain 'h2'. "
+ "Please check your configuration."); + "Please check your configuration.");
throw new IllegalStateException( throw new IllegalStateException(
"Datasource type is H2, but the URL does not contain 'h2'. Please check your" "Datasource type is H2, but the URL does not contain 'h2'. Please check your"
+ " configuration."); + " configuration.");
} else if (!isTypeH2 && isDBUrlH2) { } else if (!isTypeH2 && isDBUrlH2 && isCustomDatabase) {
log.warn( log.warn(
"Datasource URL contains 'h2', but the type is not H2. " "Datasource URL contains 'h2', but the type is not H2. "
+ "Please check your configuration."); + "Please check your configuration.");
@ -265,7 +266,7 @@ public class DatabaseService implements DatabaseInterface {
boolean isH2 = isTypeH2 && isDBUrlH2; boolean isH2 = isTypeH2 && isDBUrlH2;
return !datasource.isEnableCustomDatabase() || isH2; return !isCustomDatabase || isH2;
} }
/** /**