]> git.mxchange.org Git - jcore.git/blobdiff - src/org/mxchange/jcore/BaseFrameworkSystem.java
A lot changes on jcore:
[jcore.git] / src / org / mxchange / jcore / BaseFrameworkSystem.java
index 6d7ca8a5f1d848cbe75a81be47017f06b65d5cb4..515981d72ae2a63dd8725ecbc7d49ee48e1f81f9 100644 (file)
@@ -194,26 +194,26 @@ public class BaseFrameworkSystem implements FrameworkInterface {
         * @param targetClass Class name to look for
         * @return Class instance
         */
-       @SuppressWarnings ("unchecked")
+       @SuppressWarnings("unchecked")
        private Class<? extends FrameworkInterface> getClassFromTarget (final FrameworkInterface instance, final String targetClass) {
                // Trace message
                this.getLogger().debug(MessageFormat.format("instance={0},targetClass={1}", instance, targetClass)); //NOI18N
-               
+
                // Instance reflaction of this class
                Class<? extends FrameworkInterface> c = instance.getClass();
-               
+
                // Analyze class
                while (!targetClass.equals(c.getSimpleName())) {
                        // Debug message
                        this.getLogger().debug(MessageFormat.format("c={0}", c.getSimpleName())); //NOI18N
-                       
+
                        // Get super class (causes unchecked warning)
                        c = (Class<? extends FrameworkInterface>) c.getSuperclass();
                }
 
                // Trace message
                this.getLogger().trace(MessageFormat.format("c={0} - EXIT!", c)); //NOI18N
-               
+
                // Return it
                return c;
        }
@@ -265,7 +265,7 @@ public class BaseFrameworkSystem implements FrameworkInterface {
        protected final void abortProgramWithException (final Throwable throwable) {
                // Log exception ...
                this.getLogger().catching(throwable);
-               
+
                // .. and exit
                System.exit(1);
        }
@@ -353,7 +353,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("database.backend.storagepath", "data/"); //NOI18N
 
                // For MySQL backend
                BaseFrameworkSystem.properties.put("org.mxchange.database.mysql.host", "localhost"); //NOI18N
@@ -567,10 +567,10 @@ public class BaseFrameworkSystem implements FrameworkInterface {
        protected Object getField (final FrameworkInterface instance, final String targetClass, final String methodName) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                // Trace messahe
                this.getLogger().trace(MessageFormat.format("targetClass={0},methodName={1}", targetClass, methodName)); //NOI18N
-               
+
                // Get method to call
                Method method = this.getMethodFromName(instance, targetClass, methodName);
-               
+
                // Get value from field
                Object object = method.invoke(instance);
 
@@ -606,7 +606,7 @@ public class BaseFrameworkSystem implements FrameworkInterface {
        protected Object convertNullToEmpty (final Object str) {
                // Trace message
                this.getLogger().trace(MessageFormat.format("str={0}", str)); //NOI18N
-               
+
                // Is it null?
                if (str == null) {
                        // Return empty string
@@ -615,7 +615,7 @@ public class BaseFrameworkSystem implements FrameworkInterface {
 
                // Trace message
                this.getLogger().trace(MessageFormat.format("str={0} - EXIT!", str)); //NOI18N
-               
+
                // Return it
                return str;
        }
@@ -735,6 +735,9 @@ public class BaseFrameworkSystem implements FrameworkInterface {
         * Initializes i18n bundles
         */
        protected void initBundle () {
+               // Trace message
+               this.getLogger().trace("CALLED!");
+
                // Is the bundle set?
                if (bundle instanceof ResourceBundle) {
                        // Is already set
@@ -743,11 +746,14 @@ public class BaseFrameworkSystem implements FrameworkInterface {
 
                // Set instance
                bundle = ResourceBundle.getBundle(FrameworkInterface.I18N_BUNDLE_FILE); // NOI18N
+
+               // Trace message
+               this.getLogger().trace("EXIT!");
        }
 
        /**
         * Prepares all properties, the file is written if it is not found
-        * 
+        *
         * @throws java.io.IOException If any IO problem occurs
         */
        protected void initProperties () throws IOException {
@@ -836,6 +842,15 @@ public class BaseFrameworkSystem implements FrameworkInterface {
                // Trace message
                this.getLogger().trace(MessageFormat.format("key={0},value={1} - CALLED!", key, value)); //NOI18N
 
+               // Both should not be null
+               if (key == null) {
+                       // key is null
+                       throw new NullPointerException("key is null");
+               } else if (value == null) {
+                       // value is null
+                       throw new NullPointerException("value is null");
+               }
+
                // Set it
                properties.setProperty(String.format("org.mxchange.%s", key), value); //NOI18N