Commit 3cd96976 authored by Luna Riegel's avatar Luna Riegel
Browse files

Fix: Add null-handling for poolSize property

parent 1b3eb97f
...@@ -51,19 +51,19 @@ public final class DatabaseSettings { ...@@ -51,19 +51,19 @@ public final class DatabaseSettings {
boolean attemptFallback = attemptFallbackString == null || Boolean.parseBoolean(attemptFallbackString); boolean attemptFallback = attemptFallbackString == null || Boolean.parseBoolean(attemptFallbackString);
boolean debugMode = Boolean.parseBoolean(debugModeString); boolean debugMode = Boolean.parseBoolean(debugModeString);
boolean tempMode = Boolean.parseBoolean(tempModeString); boolean tempMode = Boolean.parseBoolean(tempModeString);
int poolSize;
int poolSize = defaultConfig.connectionPoolSize();
if (poolSizeString != null && !poolSizeString.isBlank()){
try { try {
poolSize = Integer.parseInt(poolSizeString); int size = Integer.parseInt(poolSizeString);
if (poolSize < 1) { if (size < 1) {
//TODO: Localize String logger.warn(Localization.getText("DatabaseSettings.poolSizeLessThanOne"));
logger.warn("poolSize property cannot be less than 1, using default value"); } else poolSize = size;
poolSize = defaultConfig.connectionPoolSize();
}
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
//TODO: Localize String logger.warn(Localization.getText("DatabaseSettings.poolSizeNaN"));
logger.warn("poolSize property must be an integer, using default value");
poolSize = defaultConfig.connectionPoolSize();
} }
}
if (name == null || name.isBlank()){ if (name == null || name.isBlank()){
name = defaultConfig.databaseName(); name = defaultConfig.databaseName();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment