]> git.mxchange.org Git - jcore.git/commitdiff
Added null check + fixed path for file-based database backends
authorRoland Haeder <roland@mxchange.org>
Wed, 19 Aug 2015 15:24:54 +0000 (17:24 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 19 Aug 2015 15:24:54 +0000 (17:24 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/jcore/BaseFrameworkSystem.java
src/org/mxchange/jcore/database/backend/BaseDatabaseBackend.java
src/org/mxchange/jcore/exceptions/UnsupportedDatabaseDriverException.java

index 4b6d02567537cbb0ca4b302400f8a3942d0e1ca8..9e74ec3748ac2f75d5268a2315693b6d36322310 100644 (file)
@@ -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
index 39a773e27c11fdfd1bc9fca2ba1f3e5fbdf13d7a..d63fafc5ab4af894217ab3432db6377f309a2d4a 100644 (file)
@@ -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<Driver> drivers = DriverManager.getDrivers();
 
                // Default is not found
index 3cc925d417c3c1a18c0157299c26cd50048bade5..c97a26a7e75fbe256b44f931cb21f1f8d3ae1069 100644 (file)
@@ -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
        }
        
 }