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 {
boolean attemptFallback = attemptFallbackString == null || Boolean.parseBoolean(attemptFallbackString);
boolean debugMode = Boolean.parseBoolean(debugModeString);
boolean tempMode = Boolean.parseBoolean(tempModeString);
int poolSize;
try {
poolSize = Integer.parseInt(poolSizeString);
if (poolSize < 1) {
//TODO: Localize String
logger.warn("poolSize property cannot be less than 1, using default value");
poolSize = defaultConfig.connectionPoolSize();
}
} catch (NumberFormatException e) {
//TODO: Localize String
logger.warn("poolSize property must be an integer, using default value");
poolSize = defaultConfig.connectionPoolSize();
int poolSize = defaultConfig.connectionPoolSize();
if (poolSizeString != null && !poolSizeString.isBlank()){
try {
int size = Integer.parseInt(poolSizeString);
if (size < 1) {
logger.warn(Localization.getText("DatabaseSettings.poolSizeLessThanOne"));
} else poolSize = size;
} catch (NumberFormatException e) {
logger.warn(Localization.getText("DatabaseSettings.poolSizeNaN"));
}
}
if (name == null || name.isBlank()){
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