*/
package org.mxchange.addressbook.application;
+import java.io.IOException;
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;
/**
* Protected constructor
+ * @throws java.io.IOException If any IO error occurs
*/
- protected AddressbookApplication () {
- // Always init i18n bundle in this application
- this.initBundle();
- }
+ protected AddressbookApplication () throws IOException {
+ // Init properties file
+ this.initProperties();
- /**
- * Getter for printable application name
- *
- * @return A printable name
- */
- public static String printableTitle () {
- return MessageFormat.format("{0} v{1}", APP_TITLE, APP_VERSION); //NOI18N
+ // Init bundle
+ this.initBundle();
}
/**
this.getLogger().debug("Main loop exit - shutting down ..."); //NOI18N
}
+ /**
+ * Shuts down the application.
+ */
+ @Override
+ public void doShutdown () {
+ // Trace message
+ this.getLogger().trace("CALLED!"); //NOI18N
+
+ // Shutdown client
+ this.getClient().doShutdown();
+
+ this.getLogger().info("End of program (last line)"); //NOI18N
+ System.exit(0);
+ }
+
/**
* Enables console client by setting propper flag
*/
* @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);
+ }
}
/**
- * Shuts down the application.
+ * Getter for printable application name
+ *
+ * @return A printable name
*/
- @Override
- public void doShutdown () {
- // Trace message
- this.getLogger().trace("CALLED!"); //NOI18N
-
- // Shutdown client
- this.getClient().doShutdown();
-
- this.getLogger().info("End of program (last line)"); //NOI18N
- System.exit(0);
+ public static String printableTitle () {
+ return MessageFormat.format("{0} v{1}", APP_TITLE, APP_VERSION); //NOI18N
}
}