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

Fix: Add null-handling for poolSize property

parent 1b3eb97f
...@@ -51,20 +51,20 @@ public final class DatabaseSettings { ...@@ -51,20 +51,20 @@ 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;
try { int poolSize = defaultConfig.connectionPoolSize();
poolSize = Integer.parseInt(poolSizeString); if (poolSizeString != null && !poolSizeString.isBlank()){
if (poolSize < 1) { try {
//TODO: Localize String int size = Integer.parseInt(poolSizeString);
logger.warn("poolSize property cannot be less than 1, using default value"); if (size < 1) {
poolSize = defaultConfig.connectionPoolSize(); logger.warn(Localization.getText("DatabaseSettings.poolSizeLessThanOne"));
} } else poolSize = size;
} 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