]> git.mxchange.org Git - jbonuscard-lib.git/blobdiff - Addressbook/src/org/mxchange/addressbook/application/AddressbookApplication.java
Added and implemented missing methods
[jbonuscard-lib.git] / Addressbook / src / org / mxchange / addressbook / application / AddressbookApplication.java
index c14c64fa8e1ce3339a00542fe161918a963bbc9a..4be3359bdbe5fb7c6a7cbb6d3d62d55fdaed979b 100644 (file)
  */
 package org.mxchange.addressbook.application;
 
+import java.io.IOException;
+import java.sql.SQLException;
 import java.text.MessageFormat;
 import org.mxchange.addressbook.BaseAddressbookSystem;
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.console.ConsoleClient;
 import org.mxchange.addressbook.client.gui.SwingClient;
+import org.mxchange.jcore.BaseFrameworkSystem;
 import org.mxchange.jcore.application.Application;
 import org.mxchange.jcore.client.Client;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
@@ -140,9 +143,13 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
 
        /**
         * Protected constructor
+        * @throws java.io.IOException If any IO error occurs
         */
-       protected AddressbookApplication () {
-               // Always init i18n bundle in this application
+       protected AddressbookApplication () throws IOException {
+               // Init properties file
+               this.initProperties();
+
+               // Init bundle
                this.initBundle();
        }
 
@@ -235,7 +242,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
         * Shuts down the application.
         */
        @Override
-       public void doShutdown () {
+       public void doShutdown () throws SQLException, IOException {
                // Trace message
                this.getLogger().trace("CALLED!"); //NOI18N
                
@@ -331,6 +338,13 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
         */
        private void start (final String args[]) {
                this.getLogger().info("Program is started."); //NOI18N
+               try {
+                       // Init properties file
+                       this.initProperties();
+               } catch (final IOException ex) {
+                       // Something bad happened
+                       this.abortProgramWithException(ex);
+               }
 
                // Parse arguments
                this.parseArguments(args);
@@ -340,7 +354,11 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
 
                // Good bye, but this should not be reached ...
                this.getLogger().warn("Unusual exit reached."); //NOI18N
-               this.doShutdown();
+               try {
+                       this.doShutdown();
+               } catch (final SQLException | IOException ex) {
+                       this.abortProgramWithException(ex);
+               }
        }
 
        /**
@@ -349,8 +367,14 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
         * @param args the command line arguments
         */
        public static void main (String[] args) {
-               // Start application
-               new AddressbookApplication().start(args);
+               try {
+                       // Start application
+                       new AddressbookApplication().start(args);
+               } catch (final IOException ex) {
+                       // Get instance
+                       BaseFrameworkSystem.getInstance().getLogger().catching(ex);
+                       System.exit(1);
+               }
        }
 
        /**