]> git.mxchange.org Git - addressbook-swing.git/commitdiff
Fixes for missing throws statements (because jcore has changed).
authorRoland Haeder <roland@mxchange.org>
Wed, 12 Aug 2015 15:47:05 +0000 (17:47 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 12 Aug 2015 16:00:47 +0000 (18:00 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

Addressbook/src/org/mxchange/addressbook/BaseAddressbookSystem.java
Addressbook/src/org/mxchange/addressbook/application/AddressbookApplication.java
Addressbook/src/org/mxchange/addressbook/client/BaseAddressbookClient.java
Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java
Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java
Addressbook/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java
Addressbook/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactFrontend.java
Addressbook/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java

index a835d3f4a88a8a6182109f491b2543d116ffaa38..aa8c235ad6d6c0d30e538f0125a8d03410487ce4 100644 (file)
@@ -28,7 +28,5 @@ public class BaseAddressbookSystem extends BaseFrameworkSystem {
         * No instances can be created of this class
         */
        protected BaseAddressbookSystem () {
         * No instances can be created of this class
         */
        protected BaseAddressbookSystem () {
-               // Init properties file
-               this.initProperties();
        }
 }
        }
 }
index c14c64fa8e1ce3339a00542fe161918a963bbc9a..ea26bc1ec1bbe7117f389c6c3a2a0fcd9254202d 100644 (file)
  */
 package org.mxchange.addressbook.application;
 
  */
 package org.mxchange.addressbook.application;
 
+import java.io.IOException;
 import java.text.MessageFormat;
 import org.mxchange.addressbook.BaseAddressbookSystem;
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.console.ConsoleClient;
 import org.mxchange.addressbook.client.gui.SwingClient;
 import java.text.MessageFormat;
 import org.mxchange.addressbook.BaseAddressbookSystem;
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.console.ConsoleClient;
 import org.mxchange.addressbook.client.gui.SwingClient;
+import org.mxchange.jcore.BaseFrameworkSystem;
 import org.mxchange.jcore.application.Application;
 import org.mxchange.jcore.client.Client;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
 import org.mxchange.jcore.application.Application;
 import org.mxchange.jcore.client.Client;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
@@ -140,9 +142,13 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
 
        /**
         * Protected constructor
 
        /**
         * Protected constructor
+        * @throws java.io.IOException If any IO error occurs
         */
         */
-       protected AddressbookApplication () {
-               // Always init i18n bundle in this application
+       protected AddressbookApplication () throws IOException {
+               // Init properties file
+               this.initProperties();
+
+               // Init bundle
                this.initBundle();
        }
 
                this.initBundle();
        }
 
@@ -349,8 +355,14 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App
         * @param args the command line arguments
         */
        public static void main (String[] args) {
         * @param args the command line arguments
         */
        public static void main (String[] args) {
-               // Start application
-               new AddressbookApplication().start(args);
+               try {
+                       // Start application
+                       new AddressbookApplication().start(args);
+               } catch (final IOException ex) {
+                       // Get instance
+                       BaseFrameworkSystem.getInstance().getLogger().catching(ex);
+                       System.exit(1);
+               }
        }
 
        /**
        }
 
        /**
index faafb9d0a344f39565fa5de05102b0e21ab60820..2f2e2aa286b98a1f52ec6a5dfb1ceecbedc5c628 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.client;
 
  */
 package org.mxchange.addressbook.client;
 
+import java.sql.SQLException;
 import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Map;
 import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Map;
@@ -23,6 +24,7 @@ import org.mxchange.addressbook.manager.contact.AddressbookContactManager;
 import org.mxchange.addressbook.menu.Menu;
 import org.mxchange.jcore.client.BaseClient;
 import org.mxchange.jcore.client.Client;
 import org.mxchange.addressbook.menu.Menu;
 import org.mxchange.jcore.client.BaseClient;
 import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
 import org.mxchange.jcore.manager.database.ManageableDatabase;
 
 /**
 import org.mxchange.jcore.manager.database.ManageableDatabase;
 
 /**
@@ -104,8 +106,10 @@ public abstract class BaseAddressbookClient extends BaseClient {
 
        /**
         * Initializes contact manager
 
        /**
         * Initializes contact manager
+        * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
+        * @throws java.sql.SQLException If any SQL error occurs
         */
         */
-       protected void initContactManager () {
+       protected void initContactManager () throws UnsupportedDatabaseBackendException, SQLException {
                // Trace message
                this.getLogger().trace("CALLED!"); //NOI18N
                
                // Trace message
                this.getLogger().trace("CALLED!"); //NOI18N
                
index 8a7bececed03fda5851e44b92d0a7a139cfb8983..176418b4f38849891d7cf7936bf4a40a467dff13 100644 (file)
  */
 package org.mxchange.addressbook.client.console;
 
  */
 package org.mxchange.addressbook.client.console;
 
+import java.sql.SQLException;
 import java.text.MessageFormat;
 import java.util.Arrays;
 import java.util.Scanner;
 import org.mxchange.addressbook.application.AddressbookApplication;
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.BaseAddressbookClient;
 import java.text.MessageFormat;
 import java.util.Arrays;
 import java.util.Scanner;
 import org.mxchange.addressbook.application.AddressbookApplication;
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.BaseAddressbookClient;
-import org.mxchange.jcore.contact.Contact;
-import org.mxchange.jcore.contact.Gender;
 import org.mxchange.addressbook.contact.user.UserContact;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
 import org.mxchange.addressbook.manager.contact.ManageableAddressbookContact;
 import org.mxchange.addressbook.contact.user.UserContact;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
 import org.mxchange.addressbook.manager.contact.ManageableAddressbookContact;
@@ -33,7 +32,10 @@ import org.mxchange.addressbook.menu.console.ConsoleMenu;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.addressbook.menu.item.console.ConsoleMenuItem;
 import org.mxchange.jcore.application.Application;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.addressbook.menu.item.console.ConsoleMenuItem;
 import org.mxchange.jcore.application.Application;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
 
 /**
  * A client for the console
 
 /**
  * A client for the console
@@ -548,7 +550,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
        }
 
        /**
        }
 
        /**
-        * Inizializes this client
+        * Initializes this client
         */
        @Override
        public void init () {
         */
        @Override
        public void init () {
@@ -556,7 +558,12 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                this.getLogger().trace("CALLED!"); //NOI18N
 
                // Init contact manager here
                this.getLogger().trace("CALLED!"); //NOI18N
 
                // Init contact manager here
-               this.initContactManager();
+               try {
+                       this.initContactManager();
+               } catch (final UnsupportedDatabaseBackendException | SQLException ex) {
+                       // End here
+                       this.abortProgramWithException(ex);
+               }
 
                // Fill menu map
                this.fillMenuMap();
 
                // Fill menu map
                this.fillMenuMap();
index be62260e3ad3660d7b7869e6a2d8abd270e7b0bb..8a27f24c3d6e3f01ed730c41119f8f2e950f24ca 100644 (file)
  */
 package org.mxchange.addressbook.client.gui;
 
  */
 package org.mxchange.addressbook.client.gui;
 
-import org.mxchange.jcore.client.gui.ClientFrame;
+import java.sql.SQLException;
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.BaseAddressbookClient;
 import org.mxchange.addressbook.menu.Menu;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.jcore.application.Application;
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.BaseAddressbookClient;
 import org.mxchange.addressbook.menu.Menu;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.jcore.application.Application;
+import org.mxchange.jcore.client.gui.ClientFrame;
 import org.mxchange.jcore.contact.Contact;
 import org.mxchange.jcore.contact.Gender;
 import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
 import org.mxchange.jcore.contact.Contact;
 import org.mxchange.jcore.contact.Gender;
 import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
 
 /**
  *
 
 /**
  *
@@ -177,13 +179,13 @@ public class SwingClient extends BaseAddressbookClient implements AddressbookCli
                // Debug message
                this.getLogger().trace("CALLED!"); //NOI18N
 
                // Debug message
                this.getLogger().trace("CALLED!"); //NOI18N
 
-               // Init contact manager here
-               this.initContactManager();
-
                try {
                try {
+                       // Init contact manager here
+                       this.initContactManager();
+
                        // Init frame
                        this.frame.init();
                        // Init frame
                        this.frame.init();
-               } catch (final FrameAlreadyInitializedException ex) {
+               } catch (final FrameAlreadyInitializedException | UnsupportedDatabaseBackendException | SQLException ex) {
                        // Abort program
                        this.abortProgramWithException(ex);
                }
                        // Abort program
                        this.abortProgramWithException(ex);
                }
index 9b574f3d0390d6757e61b0aa02318cc3818d9ff1..25e2bf87b52a5607f8e320beca802a7b9baaef6b 100644 (file)
@@ -47,8 +47,10 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp
         * Constructor which accepts a contact manager
         *
         * @param manager Manager instance
         * Constructor which accepts a contact manager
         *
         * @param manager Manager instance
+        * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
+        * @throws java.sql.SQLException If any SQL error occurs
         */
         */
-       public AddressbookContactDatabaseFrontend (final AddressbookContactManager manager) {
+       public AddressbookContactDatabaseFrontend (final AddressbookContactManager manager) throws UnsupportedDatabaseBackendException, SQLException {
                // Call own constructor
                this();
 
                // Call own constructor
                this();
 
@@ -66,7 +68,7 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp
        }
 
        /**
        }
 
        /**
-        * Basic constrcutor
+        * Default but protected constructor
         * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
         * @throws java.sql.SQLException Any SQL exception from e.g. MySQL connector
         */
         * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
         * @throws java.sql.SQLException Any SQL exception from e.g. MySQL connector
         */
@@ -226,9 +228,11 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp
         * Checks whether own contact is found in database
         *
         * @return Whether own contact is found
         * Checks whether own contact is found in database
         *
         * @return Whether own contact is found
+        * @throws java.io.IOException If any IO error occurs
+        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
         */
        @Override
         */
        @Override
-       public boolean isOwnContactFound () throws SQLException {
+       public boolean isOwnContactFound () throws SQLException, IOException, BadTokenException {
                // Get search criteria instance
                SearchableCritera critera = new SearchCriteria();
 
                // Get search criteria instance
                SearchableCritera critera = new SearchCriteria();
 
index 5c2cc8a24f1e77389e94d1aac49155cc9ce3e8e9..9e7e83fba11bd59122144d03fe117f0ddf62a5fa 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.database.frontend.contact;
 
  */
 package org.mxchange.addressbook.database.frontend.contact;
 
+import java.io.IOException;
 import java.sql.SQLException;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
 import org.mxchange.jcore.contact.Contact;
 import java.sql.SQLException;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
 import org.mxchange.jcore.contact.Contact;
@@ -66,8 +67,10 @@ public interface AddressbookContactFrontend extends DatabaseFrontend {
         * 
         * @return Whether own contact is found
         * @throws java.sql.SQLException If any SQL error occurs
         * 
         * @return Whether own contact is found
         * @throws java.sql.SQLException If any SQL error occurs
+        * @throws java.io.IOException If an IO error occurs
+        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
         */
         */
-       public boolean isOwnContactFound () throws SQLException;
+       public boolean isOwnContactFound () throws SQLException, IOException, BadTokenException;
 
        /**
         * Reads a single row and parses it to a contact instance
 
        /**
         * Reads a single row and parses it to a contact instance
index b85e9d3690c070435aec0cd530f344b3a095995c..980c64b69490f047bb9727a651d8f1e6965ef889 100644 (file)
@@ -16,6 +16,8 @@
  */
 package org.mxchange.addressbook.manager.contact;
 
  */
 package org.mxchange.addressbook.manager.contact;
 
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
 import java.sql.SQLException;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.sql.SQLException;
 import java.text.MessageFormat;
 import java.util.ArrayList;
@@ -31,6 +33,7 @@ import org.mxchange.jcore.contact.Contact;
 import org.mxchange.jcore.contact.Gender;
 import org.mxchange.jcore.exceptions.BadTokenException;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
 import org.mxchange.jcore.contact.Gender;
 import org.mxchange.jcore.exceptions.BadTokenException;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
 import org.mxchange.jcore.manager.BaseManager;
 
 /**
 import org.mxchange.jcore.manager.BaseManager;
 
 /**
@@ -61,8 +64,10 @@ public class AddressbookContactManager extends BaseManager implements Manageable
         * a client instance.
         *
         * @param client Client instance to use
         * a client instance.
         *
         * @param client Client instance to use
+        * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
+        * @throws java.sql.SQLException If an SQL error occurs
         */
         */
-       public AddressbookContactManager (final Client client) {
+       public AddressbookContactManager (final Client client) throws UnsupportedDatabaseBackendException, SQLException {
                // Trace message
                this.getLogger().trace(MessageFormat.format("client={1} - CALLED!", client)); //NOI18N
 
                // Trace message
                this.getLogger().trace(MessageFormat.format("client={1} - CALLED!", client)); //NOI18N
 
@@ -327,9 +332,12 @@ public class AddressbookContactManager extends BaseManager implements Manageable
 
        /**
         * Shuts down this contact manager
 
        /**
         * Shuts down this contact manager
+        * 
+        * @throws java.sql.SQLException If an SQL error occurs
+        * @throws java.io.IOException If an IO error occurs
         */
        @Override
         */
        @Override
-       public void doShutdown () {
+       public void doShutdown () throws SQLException, IOException {
                // Trace message
                this.getLogger().trace("CALLED!"); //NOI18N
 
                // Trace message
                this.getLogger().trace("CALLED!"); //NOI18N
 
@@ -615,7 +623,12 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                this.getLogger().debug(MessageFormat.format("columnName={0}", columnName));
 
                // Now get that column
                this.getLogger().debug(MessageFormat.format("columnName={0}", columnName));
 
                // Now get that column
-               Object value = contact.getValueFromColumn(columnName);
+               Object value = null;
+               try {
+                       value = contact.getValueFromColumn(columnName);
+               } catch (final IllegalArgumentException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+                       this.abortProgramWithException(ex);
+               }
 
                // Trace message
                this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value));
 
                // Trace message
                this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value));
@@ -641,7 +654,7 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                try {
                        // Deligate this call to frontend
                        isAdded = this.getContactDatabase().isOwnContactFound();
                try {
                        // Deligate this call to frontend
                        isAdded = this.getContactDatabase().isOwnContactFound();
-               } catch (final SQLException ex) {
+               } catch (final SQLException | IOException | BadTokenException ex) {
                        // Something bad happened
                        this.abortProgramWithException(ex);
                }
                        // Something bad happened
                        this.abortProgramWithException(ex);
                }