From: Roland Haeder Date: Wed, 19 Aug 2015 15:24:54 +0000 (+0200) Subject: Added null check + fixed path for file-based database backends X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f802480190d566206ae94252549b41a2a16bc21e;p=jcore.git Added null check + fixed path for file-based database backends Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/jcore/BaseFrameworkSystem.java b/src/org/mxchange/jcore/BaseFrameworkSystem.java index 4b6d025..9e74ec3 100644 --- a/src/org/mxchange/jcore/BaseFrameworkSystem.java +++ b/src/org/mxchange/jcore/BaseFrameworkSystem.java @@ -364,7 +364,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { // Init default values: // Default database backend BaseFrameworkSystem.properties.put("org.mxchange.database.backend.class", "org.mxchange.jcore.database.backend.base64.Base64CsvDatabaseBackend"); //NOI18N - BaseFrameworkSystem.properties.put("database.backend.storagepath", "data/"); //NOI18N + BaseFrameworkSystem.properties.put("org.mxchange.database.backend.storagepath", "data/"); //NOI18N // For MySQL backend BaseFrameworkSystem.properties.put("org.mxchange.database.mysql.host", "localhost"); //NOI18N diff --git a/src/org/mxchange/jcore/database/backend/BaseDatabaseBackend.java b/src/org/mxchange/jcore/database/backend/BaseDatabaseBackend.java index 39a773e..d63fafc 100644 --- a/src/org/mxchange/jcore/database/backend/BaseDatabaseBackend.java +++ b/src/org/mxchange/jcore/database/backend/BaseDatabaseBackend.java @@ -46,7 +46,13 @@ public class BaseDatabaseBackend extends BaseFrameworkSystem { // Trace message this.getLogger().trace(MessageFormat.format("driverName={0} - CALLED!", driverName)); //NOI18N - // Try to find the driver in driver list + // driverName shall not be null + if (driverName == null) { + // Is null + throw new NullPointerException("driverName is null"); + } + + // Get all registered/installed drivers Enumeration drivers = DriverManager.getDrivers(); // Default is not found diff --git a/src/org/mxchange/jcore/exceptions/UnsupportedDatabaseDriverException.java b/src/org/mxchange/jcore/exceptions/UnsupportedDatabaseDriverException.java index 3cc925d..c97a26a 100644 --- a/src/org/mxchange/jcore/exceptions/UnsupportedDatabaseDriverException.java +++ b/src/org/mxchange/jcore/exceptions/UnsupportedDatabaseDriverException.java @@ -31,7 +31,7 @@ public class UnsupportedDatabaseDriverException extends Exception { */ public UnsupportedDatabaseDriverException (final String driverName) { // Call super method - super(MessageFormat.format("Database driver {0} is not found.", driverName)); + super(MessageFormat.format("Database driver {0} is not found.", driverName)); //NOI18N } }