]> git.mxchange.org Git - jaddressbook-lib.git/commitdiff
Try to shutdown on unclean application start
authorRoland Haeder <roland@mxchange.org>
Fri, 4 Sep 2015 18:55:34 +0000 (20:55 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 4 Sep 2015 18:55:34 +0000 (20:55 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/addressbook/application/AddressbookApplication.java
src/org/mxchange/addressbook/client/BaseAddressbookClient.java

index 21af4307ae90401fc7614eed849aa1eb913602b2..485e7a5b2c4797c280e5bc5f1cf4374e81d4eac0 100644 (file)
@@ -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);
                }
 
index 679bb4a727f12f7794e1d7285d1449e9cb0458e1..8f0dc1aae6374bae4484b98b46cc7718980b52b7 100644 (file)
@@ -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 {