From 3a5ed167e6e6074ff530c07e6e4dfad9ccfd8077 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 12 Aug 2015 20:18:03 +0200 Subject: [PATCH] =?utf8?q?Added=20more=20thrown=20exceptions=20or=20catch?= =?utf8?q?=20them.=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../addressbook/client/console/ConsoleClient.java | 8 +++++++- .../addressbook/client/gui/AddressbookFrame.java | 9 ++++++++- .../contact/AddressbookContactDatabaseFrontend.java | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) 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 -- 2.39.5