From 8ef9a410dc1a2a9c14764fd9d0fcce49dd3e58eb Mon Sep 17 00:00:00 2001 From: Roland Haeder <roland@mxchange.org> Date: Mon, 24 Aug 2015 14:18:10 +0200 Subject: [PATCH] =?utf8?q?Updated=20jcore=20+=20added=20more=20thrown=20ex?= =?utf8?q?ceptions=20+=20catched=20them=20Signed-off-by:Roland=20H=C3=A4de?= =?utf8?q?r=20<roland@mxchange.org>?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/jcore.jar | Bin 112955 -> 113036 bytes .../client/console/ConsoleClient.java | 19 ++-- .../client/gui/AddressbookFrame.java | 4 +- .../AddressbookContactDatabaseFrontend.java | 67 +++++++------- .../contact/AddressbookContactFrontend.java | 17 ++-- .../contact/AddressbookContactManager.java | 82 +++++++++--------- .../contact/ManageableAddressbookContact.java | 14 ++- 7 files changed, 103 insertions(+), 100 deletions(-) diff --git a/lib/jcore.jar b/lib/jcore.jar index d426e0dec31b4479bf275fbb9cc6ca3ba25ffd7c..5a46f43c19df0400e7fd341521152ed3a8d56f59 100644 GIT binary patch delta 2036 zcmY*ZYfzMB6n>xGWxs`8E=vd^#4Z#K8j5M6h$iZUr0xK&mW3pST-02&Fd9XYhD`I4 z@Xh!-<Ap`;7h$>RDr%!mQ!`GcPBnI!%1Iq(8ceIfoPIQ&^L?1GGw(j<JkL4jJ@4&1 z`=@#DUuIj*5~C?d2#XMRJ+-!ph9OVw%zN~&Cc(+D7!wV5J?a*uu-B#}s=g50s4OCH zB9%2?K%$yq7{_L>IZ@5tY8e$qC320FI~b^bVhG}jDO`%&3vHG<qsG{b3t7lD&iY?B z#;|$WxQHRrw1lD1l*!O(n#=H;X+Fc`fO$MI7j?$j$4=}En9U*7lq_pOP|)KAb3Ahv zd7%YXHQ#LEz!Gzo9zT=8Mr}JoEi$wkqt{JJiju(ro0S<1ZA$t`xcvAK%xairJayDR z$zsZ3oVxOJBjdxoIxz0dzlD$?&-g{Tt^1lhCLuf~wag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6yFVCqWYL!zZZ>BABajKLS<F$FN zZl#rSVJxTnc!8cr6=aj1zjjcdl&qC>S29nkXbpCfC#9CINHguHO>$9EPfimgI!LP} zlX-}mW!9}G`rH@NCoQzg-%#V=Rwu0#1kZ93b{hY{NlCy9UjBC{Vb}AC9*X1z?ed87 z#&*K_;H$a>`LLZ{MsN(lvJS#)<y$%k8=TvbcBO-sA^5w43cO+@uk55nGmi02-SMQ8 z-UgZFq9UNnMQ;J0xo90Q`wZm++s=r+AyAh0>(Y}&H)}zPMsSvO@u^o#=%zxi7|GkZ z^)5w2k^Dh7;Sj=(Q^eoxq1S+7;%uNa#rEo^qF%ksSg+n_z**V^)6TP03cP++Z#ce> z-auT_rw?+oPtRL&jy8Zld`^E9Kb@nEh*SFYyc7LYjCiV_%7KLg<N#hCpzXk<L3#(s z2Wby5z)dy4BW|h!K66tEuy}~dfR~5J;Xmu>@bqE5<<?<}G(67bF=G^>*}k#y+r#p6 z{PBq3Un!dAL;33?gd@s}A>1mK0zWaLzrKsoT?*2!RaOLX|54o?Gb-GUty176qx!CD z2H91nyPXwwJ|*1I=x^@n!yk?kW4JQJ0h<1EH5}#kG5u{<kBRKI9mtO5cXm?{zq6BU ze7!@Q*qrlZwWCnM@$otJ2F7q@PFE4=Y8c!#lWFIhE4@jWY~y)RxVZ{)$jrAoj!%l3 zkgr1iu|~@BJDpKSe!QwyRQSQ;z3s_Gz40NUcU%i+-PTn%ofyo^J^I6`^@xgw`e{La z`J?y^ulf+Gt8tcU<%#380NoUh3-!@KsdC##G@lQQQ?Q(UY1^UJdS5ZSxDsYHQP-sV i#m`0{S0?l>!X`wejFuS%KPUmbWP%o$`aczOuzvtt#bs;& diff --git a/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/src/org/mxchange/addressbook/client/console/ConsoleClient.java index a9c81cbf..06a6cc2b 100644 --- a/src/org/mxchange/addressbook/client/console/ConsoleClient.java +++ b/src/org/mxchange/addressbook/client/console/ConsoleClient.java @@ -17,6 +17,7 @@ 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; @@ -36,6 +37,7 @@ import org.mxchange.jcore.application.Application; import org.mxchange.jcore.contact.Contact; import org.mxchange.jcore.contact.Gender; import org.mxchange.jcore.exceptions.BadTokenException; +import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException; import org.mxchange.jcore.exceptions.UnhandledUserChoiceException; import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException; @@ -381,21 +383,20 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC manager.doDeleteOtherAddress(); break; - case '0': { - try { - // Program exit - this.getApplication().doShutdown(); - } catch (final SQLException | IOException ex) { - this.abortProgramWithException(ex); - } - } + 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 | BadTokenException ex) { + } catch (final IOException | BadTokenException | CorruptedDatabaseFileException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { // Something bad happened this.abortProgramWithException(ex); } diff --git a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index 4bdb6e98..73dc71a1 100644 --- a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -25,6 +25,7 @@ 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; @@ -55,6 +56,7 @@ import org.mxchange.jcore.client.gui.ClientFrame; import org.mxchange.jcore.contact.Contact; import org.mxchange.jcore.contact.Gender; import org.mxchange.jcore.exceptions.BadTokenException; +import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException; import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException; import org.mxchange.jcore.model.swing.contact.ContactTableModel; @@ -708,7 +710,7 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra ManageableAddressbookContact manager = (ManageableAddressbookContact) self.getClient().getManager(); try { manager.doChangeOwnData(); - } catch (final IOException | BadTokenException ex) { + } catch (final IOException | BadTokenException | CorruptedDatabaseFileException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { self.logException(ex); } } diff --git a/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java b/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java index e51b9420..25f84964 100644 --- a/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java +++ b/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java @@ -175,31 +175,43 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp return AddressbookContactDatabaseConstants.COLUMN_ID; } - /** - * Some "getter" for own contact instance - * - * @return Own contact instance - */ @Override - public Contact getOwnContact () { + public Contact getOwnContact () throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Trace message this.getLogger().trace("CALLED!"); //NOI18N - // Get row index back from backend - int rowIndex = this.getBackend().getRowIndexFromColumn(AddressbookContactDatabaseConstants.COLUMN_OWN_CONTACT, true); + // Prepare search instance + SearchableCriteria criteria = new SearchCriteria(); + + // Add criteria and limit + criteria.addCriteria(AddressbookContactDatabaseConstants.COLUMN_OWN_CONTACT, true); + criteria.setLimit(1); + + // Then search for it + Result<? extends Storeable> result = this.getBackend().doSelectByCriteria(criteria); // Debug message - this.getLogger().debug(MessageFormat.format("rowIndex={0}", rowIndex)); + this.getLogger().debug(MessageFormat.format("result={0}", result)); // Init instance Contact contact = null; - try { - // Now simply read the row - contact = (Contact) this.getBackend().readRow(rowIndex); - } catch (final BadTokenException ex) { - // Bad token found - this.abortProgramWithException(ex); + // Is there one row at least? + if (result.hasNext()) { + // Then get it + Storeable storeable = result.next(); + + // Debug message + this.getLogger().debug(MessageFormat.format("storeable={0}", storeable)); + + // Is it same instance? + if (!(storeable instanceof Contact)) { + // Not same instance + throw new IllegalArgumentException(MessageFormat.format("storeable={0} is not implementing Contact", storeable)); + } + + // Cast it securely + contact = (Contact) storeable; } // Trace message @@ -209,6 +221,11 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp return contact; } + @Override + public Storeable getStoreableAtRow (final int rowIndex) { + throw new UnsupportedOperationException("Not supported yet: rowIndex=" + rowIndex); + } + /** * Checks if given Contact is found * @@ -280,26 +297,6 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp return result.hasNext(); } - /** - * Reads a single row and parses it to a contact instance - * - * @param rowIndex Row index (also how much to skip) - * @return Contact instance - */ - @Override - public Contact readSingleContact (final int rowIndex) { - try { - // Deligate this to backend instance - return (Contact) this.getBackend().readRow(rowIndex); - } catch (final BadTokenException ex) { - // Bad token found - this.abortProgramWithException(ex); - } - - // Bad state, should not be reached - throw new IllegalStateException("This should not be reached"); - } - @Override public Storeable toStoreable (final Map<String, String> map) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { throw new UnsupportedOperationException("Not supported yet: map=" + map); diff --git a/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactFrontend.java b/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactFrontend.java index d1c46b7a..b06940a2 100644 --- a/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactFrontend.java +++ b/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactFrontend.java @@ -68,8 +68,15 @@ public interface AddressbookContactFrontend extends DatabaseFrontend { * Some "getter" for own contact instance * * @return Own contact instance + * @throws java.sql.SQLException If an SQL error occurs + * @throws java.io.IOException If an IO error occurs + * @throws org.mxchange.jcore.exceptions.BadTokenException Continued throw + * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged + * @throws java.lang.NoSuchMethodException If a method cannot be found + * @throws java.lang.IllegalAccessException If a method is not accessible + * @throws java.lang.reflect.InvocationTargetException Any other problems? */ - public Contact getOwnContact (); + public Contact getOwnContact () throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; /** * Checks whether own contact is found @@ -84,12 +91,4 @@ public interface AddressbookContactFrontend extends DatabaseFrontend { * @throws java.lang.reflect.InvocationTargetException Any other problems? */ public boolean isOwnContactFound () throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; - - /** - * Reads a single row and parses it to a contact instance - * - * @param rowIndex Row index (also how much to skip) - * @return Contact instance - */ - public Contact readSingleContact (final int rowIndex); } diff --git a/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java b/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java index d928695d..fd2a5388 100644 --- a/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java +++ b/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java @@ -31,6 +31,8 @@ import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException; import org.mxchange.jcore.client.Client; import org.mxchange.jcore.contact.Contact; import org.mxchange.jcore.contact.Gender; +import org.mxchange.jcore.database.frontend.DatabaseFrontend; +import org.mxchange.jcore.database.storage.Storeable; import org.mxchange.jcore.exceptions.BadTokenException; import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException; import org.mxchange.jcore.exceptions.UnhandledUserChoiceException; @@ -50,11 +52,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable */ private final List<String> columnNames; - /** - * A AddressbookContactFrontend instance - */ - private final AddressbookContactFrontend contactDatabase; - /** * Translated column name list */ @@ -82,7 +79,8 @@ public class AddressbookContactManager extends BaseManager implements Manageable this.setClient(client); // Init database connection - this.contactDatabase = new AddressbookContactDatabaseFrontend(this); + DatabaseFrontend frontend = new AddressbookContactDatabaseFrontend(this); + this.setFrontend(frontend); // Initialize list this.columnNames = new ArrayList<>(15); @@ -112,7 +110,7 @@ public class AddressbookContactManager extends BaseManager implements Manageable } // Add it - this.getContactDatabase().addContact(contact); + ((AddressbookContactFrontend) this.getFrontend()).addContact(contact); // Trace message this.getLogger().trace("EXIT!"); //NOI18N @@ -244,7 +242,7 @@ public class AddressbookContactManager extends BaseManager implements Manageable * Allows the user to change his/her own data */ @Override - public void doChangeOwnData () throws IOException , BadTokenException{ + public void doChangeOwnData () throws IOException , BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException{ // Trace message this.getLogger().trace("CALLED!"); //NOI18N @@ -343,7 +341,7 @@ public class AddressbookContactManager extends BaseManager implements Manageable this.getLogger().trace("CALLED!"); //NOI18N // Shut down the database layer - this.getContactDatabase().doShutdown(); + ((AddressbookContactFrontend) this.getFrontend()).doShutdown(); // Trace message this.getLogger().trace("EXIT!"); //NOI18N @@ -477,6 +475,22 @@ public class AddressbookContactManager extends BaseManager implements Manageable return client.enterString(5, 30, "Bitte geben Sie Ihre Faxnummer an: ", true); } + /** + * Asks the user for surname + * + * @return Surname of the user + */ + @Override + public String enterOwnFirstName () { + // Trace message + this.getLogger().trace("CALLED!"); //NOI18N + + // Get and cast client instance + AddressbookClient client = (AddressbookClient) this.getClient(); + + return client.enterString(2, 50, "Bitte geben Sie Ihren Vornamen ein: ", false); + } + /** * Asks the user for gender, until a valid has been entered * @@ -525,22 +539,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable return client.enterString(5, 50, "Bitte geben Sie Ihre Strasse und Hausnummer ein: ", false); } - /** - * Asks the user for surname - * - * @return Surname of the user - */ - @Override - public String enterOwnFirstName () { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Get and cast client instance - AddressbookClient client = (AddressbookClient) this.getClient(); - - return client.enterString(2, 50, "Bitte geben Sie Ihren Vornamen ein: ", false); - } - /** * Asks the user for own ZIP code * @@ -605,13 +603,13 @@ public class AddressbookContactManager extends BaseManager implements Manageable this.getLogger().trace(MessageFormat.format("rowIndex={0},columnIndex={1} CALLED!", rowIndex, columnIndex)); // Then get specific row from database which is a Contact instance - Contact contact = this.getContactDatabase().readSingleContact(rowIndex); + Storeable storeable = this.getFrontend().getStoreableAtRow(rowIndex); // Debug message - this.getLogger().debug(MessageFormat.format("contact={0}", contact)); + this.getLogger().debug(MessageFormat.format("storeable={0}", storeable)); // It may return null - if (contact == null) { + if (storeable == null) { // Nothing found this.getLogger().warn("contact is null - returning null ..."); return null; @@ -626,7 +624,7 @@ public class AddressbookContactManager extends BaseManager implements Manageable // Now get that column Object value = null; try { - value = contact.getValueFromColumn(columnName); + value = storeable.getValueFromColumn(columnName); } catch (final IllegalArgumentException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { this.abortProgramWithException(ex); } @@ -654,7 +652,7 @@ public class AddressbookContactManager extends BaseManager implements Manageable try { // Deligate this call to frontend - isAdded = this.getContactDatabase().isOwnContactFound(); + isAdded = ((AddressbookContactFrontend) this.getFrontend()).isOwnContactFound(); } catch (final SQLException | IOException | BadTokenException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { // Something bad happened this.abortProgramWithException(ex); @@ -688,7 +686,7 @@ public class AddressbookContactManager extends BaseManager implements Manageable /* NOISY-DEBUG: */ this.getLogger().debug(MessageFormat.format("Adding '{0}' '{1}' at pos '{2}' ...", contact.getFirstName(), contact.getFamilyName(), this.size())); //NOI18N // Check if contact is found - if (this.getContactDatabase().isContactFound(contact)) { + if (((AddressbookContactFrontend) this.getFrontend()).isContactFound(contact)) { // Contact already added // @todo Do something here } else if ((contact.isOwnContact()) && (this.isOwnContactAdded())) { @@ -713,7 +711,7 @@ public class AddressbookContactManager extends BaseManager implements Manageable int size = -1; try { - size = this.getContactDatabase().getContactsCount(); + size = ((AddressbookContactFrontend) this.getFrontend()).getContactsCount(); } catch (final SQLException ex) { // Something happened this.abortProgramWithException(ex); @@ -768,26 +766,24 @@ public class AddressbookContactManager extends BaseManager implements Manageable this.getLogger().trace(MessageFormat.format("getColumnCount()={0}: EXIT!", this.getColumnCount())); //NOI18N } - /** - * A AddressbookContactFrontend instance - * - * @return the database - */ - private AddressbookContactFrontend getContactDatabase () { - return this.contactDatabase; - } - /** * "Getter" for own contact instance or null if not found * * @return Contact instance or null + * @throws java.sql.SQLException If an SQL error occurs + * @throws java.io.IOException If an IO error occurs + * @throws org.mxchange.jcore.exceptions.BadTokenException Continued throw + * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged + * @throws java.lang.NoSuchMethodException If a method cannot be found + * @throws java.lang.IllegalAccessException If a method is not accessible + * @throws java.lang.reflect.InvocationTargetException Any other problems? */ - private Contact getOwnContact () { + private Contact getOwnContact () throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Trace message this.getLogger().trace("CALLED!"); //NOI18N // Deligate this call to database frontend - Contact contact = this.getContactDatabase().getOwnContact(); + Contact contact = ((AddressbookContactFrontend) this.getFrontend()).getOwnContact(); // Trace message this.getLogger().trace(MessageFormat.format("contact={0} - EXIT!", contact)); //NOI18N diff --git a/src/org/mxchange/addressbook/manager/contact/ManageableAddressbookContact.java b/src/org/mxchange/addressbook/manager/contact/ManageableAddressbookContact.java index be13daa2..6a9bb1e8 100644 --- a/src/org/mxchange/addressbook/manager/contact/ManageableAddressbookContact.java +++ b/src/org/mxchange/addressbook/manager/contact/ManageableAddressbookContact.java @@ -17,10 +17,13 @@ package org.mxchange.addressbook.manager.contact; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.sql.SQLException; import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException; import org.mxchange.jcore.contact.Contact; import org.mxchange.jcore.contact.Gender; import org.mxchange.jcore.exceptions.BadTokenException; +import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException; import org.mxchange.jcore.manager.database.ManageableDatabase; /** @@ -175,10 +178,15 @@ public interface ManageableAddressbookContact extends ManageableDatabase { /** * Let the user change own data - * @throws java.io.IOException If an IO error was found - * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found + * @throws java.sql.SQLException If an SQL error occurs + * @throws java.io.IOException If an IO error occurs + * @throws org.mxchange.jcore.exceptions.BadTokenException Continued throw + * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged + * @throws java.lang.NoSuchMethodException If a method cannot be found + * @throws java.lang.IllegalAccessException If a method is not accessible + * @throws java.lang.reflect.InvocationTargetException Any other problems? */ - public void doChangeOwnData () throws IOException , BadTokenException; + public void doChangeOwnData () throws IOException , BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; /** * Let the user delete other address -- 2.39.5