From: Roland Haeder Date: Fri, 4 Sep 2015 18:55:34 +0000 (+0200) Subject: Try to shutdown on unclean application start X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9463b102fdbe8ffed4f69353190b9106a581387b;p=jfinancials-lib.git Try to shutdown on unclean application start Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/addressbook/application/AddressbookApplication.java b/src/org/mxchange/addressbook/application/AddressbookApplication.java index 21af430..485e7a5 100644 --- a/src/org/mxchange/addressbook/application/AddressbookApplication.java +++ b/src/org/mxchange/addressbook/application/AddressbookApplication.java @@ -19,6 +19,8 @@ package org.mxchange.addressbook.application; import java.io.IOException; import java.sql.SQLException; import java.text.MessageFormat; +import java.util.logging.Level; +import java.util.logging.Logger; import org.mxchange.addressbook.BaseAddressbookSystem; import org.mxchange.addressbook.client.AddressbookClient; import org.mxchange.addressbook.client.console.ConsoleClient; @@ -165,7 +167,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App this.getLogger().debug("Initializing application ..."); //NOI18N // Init client variable - Client client = null; + Client client; // Is console or Swing choosen? if (this.isConsole()) { @@ -183,6 +185,14 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App } else { // Not client choosen this.getLogger().error("No client choosen. Cannot launch."); //NOI18N + try { + this.doShutdown(); + } catch (final SQLException | IOException ex) { + // Abort here + this.abortProgramWithException(ex); + } + + // Bye ... System.exit(1); } diff --git a/src/org/mxchange/addressbook/client/BaseAddressbookClient.java b/src/org/mxchange/addressbook/client/BaseAddressbookClient.java index 679bb4a..8f0dc1a 100644 --- a/src/org/mxchange/addressbook/client/BaseAddressbookClient.java +++ b/src/org/mxchange/addressbook/client/BaseAddressbookClient.java @@ -30,6 +30,7 @@ import org.mxchange.jcore.client.Client; * A general addressbook client * * @author Roland Haeder + * TODO: Find better name */ public abstract class BaseAddressbookClient extends BaseClient implements AddressbookClient {