From: Roland Haeder Date: Wed, 12 Aug 2015 18:18:03 +0000 (+0200) Subject: Added more thrown exceptions or catch them. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3a5ed167e6e6074ff530c07e6e4dfad9ccfd8077;p=addressbook-swing.git Added more thrown exceptions or catch them. Signed-off-by:Roland Häder --- diff --git a/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java index 04f7037..a947620 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java +++ b/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java @@ -378,8 +378,14 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC manager.doDeleteOtherAddress(); break; - case '0': // Program exit + case '0': { + try { + // Program exit this.getApplication().doShutdown(); + } catch (final SQLException | IOException ex) { + this.abortProgramWithException(ex); + } + } break; default: diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index 4459773..8661516 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -24,6 +24,8 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.io.IOException; +import java.sql.SQLException; import java.text.MessageFormat; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -293,7 +295,12 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra } // Call shutdown method - this.getClient().getApplication().doShutdown(); + try { + this.getClient().getApplication().doShutdown(); + } catch (final SQLException | IOException ex) { + // Abort here + this.abortProgramWithException(ex); + } // Trace message this.getLogger().trace("EXIT!"); //NOI18N diff --git a/Addressbook/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java b/Addressbook/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java index 25e2bf8..2b93bf8 100644 --- a/Addressbook/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java +++ b/Addressbook/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java @@ -122,7 +122,7 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp * Shuts down the database layer */ @Override - public void doShutdown () { + public void doShutdown () throws SQLException, IOException { // Trace message this.getLogger().trace("CALLED!"); //NOI18N