From 13523257b03c902e47b8967378c7df2ce61fd07f Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 5 Oct 2015 13:12:10 +0200 Subject: [PATCH] =?utf8?q?removed=20old=20lost=20stuff=20Signed-off-by:Rol?= =?utf8?q?and=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../client/console/ConsoleClient.java | 103 ++++++++---------- .../client/gui/AddressbookFrame.java | 10 +- 2 files changed, 49 insertions(+), 64 deletions(-) diff --git a/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/src/org/mxchange/addressbook/client/console/ConsoleClient.java index d5a2fbc..f8cad4b 100644 --- a/src/org/mxchange/addressbook/client/console/ConsoleClient.java +++ b/src/org/mxchange/addressbook/client/console/ConsoleClient.java @@ -17,7 +17,6 @@ package org.mxchange.addressbook.client.console; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.sql.SQLException; import java.text.MessageFormat; import java.util.Arrays; @@ -325,60 +324,54 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC // Get manager and cast it ContactFacade manager = (ContactFacade) this.getFacade(); - // Try it! - try { - // TODO Rewrite this ugly switch() block - switch (choice) { - case '1': - try { - // Enter/add own data - manager.doEnterOwnData(); - } catch (final ContactAlreadyAddedException ex) { - // Already added - this.outputMessage("Sie haben bereits Ihre eigenen Daten eingegeben."); - } - break; - - case '2': // Change own data - manager.doChangeOwnData(); - break; - - case '3': // Add new addess - manager.doAddOtherAddress(); - break; - - case '4': // List contacts - manager.doListContacts(); - break; - - case '5': // Search addresses - manager.doSearchContacts(); - break; - - case '6': // Change other addess - manager.doChangeOtherAddress(); - break; - - case '7': // Delete other address - manager.doDeleteOtherAddress(); - break; - - case '0': - try { - // Program exit - this.getApplication().doShutdown(); - } catch (final SQLException | IOException ex) { - this.abortProgramWithException(ex); - } - break; - - default: - // TODO throw own exception - throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice)); //NOI18N - } - } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { - // Something bad happened - this.abortProgramWithException(ex); + // TODO Rewrite this ugly switch() block + switch (choice) { + case '1': + try { + // Enter/add own data + manager.doEnterOwnData(); + } catch (final ContactAlreadyAddedException ex) { + // Already added + this.outputMessage("Sie haben bereits Ihre eigenen Daten eingegeben."); + } + break; + + case '2': // Change own data + manager.doChangeOwnData(); + break; + + case '3': // Add new addess + manager.doAddOtherAddress(); + break; + + case '4': // List contacts + manager.doListContacts(); + break; + + case '5': // Search addresses + manager.doSearchContacts(); + break; + + case '6': // Change other addess + manager.doChangeOtherAddress(); + break; + + case '7': // Delete other address + manager.doDeleteOtherAddress(); + break; + + case '0': + try { + // Program exit + this.getApplication().doShutdown(); + } catch (final SQLException | IOException ex) { + this.abortProgramWithException(ex); + } + break; + + default: + // TODO throw own exception + throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice)); //NOI18N } // Trace message diff --git a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index 68f80cd..3f1f05a 100644 --- a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -25,7 +25,6 @@ import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.sql.SQLException; import java.text.MessageFormat; import javax.swing.BorderFactory; @@ -708,9 +707,6 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra // Already added, log away // TODO maybe output message here? self.logException(ex); - } catch (final IOException ex) { - // Somethind bad happened here - // TODO Output error message here? } } }); @@ -730,11 +726,7 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra */ @Override public void actionPerformed (final ActionEvent e) { - try { - ((ContactFacade) self.getClient().getFacade()).doChangeOwnData(); - } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { - self.logException(ex); - } + ((ContactFacade) self.getClient().getFacade()).doChangeOwnData(); } }); -- 2.39.5