From 9463b102fdbe8ffed4f69353190b9106a581387b Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 4 Sep 2015 20:55:34 +0200 Subject: [PATCH] =?utf8?q?Try=20to=20shutdown=20on=20unclean=20application?= =?utf8?q?=20start=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../application/AddressbookApplication.java | 12 +++++++++++- .../addressbook/client/BaseAddressbookClient.java | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) 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 { -- 2.39.5