]> git.mxchange.org Git - jfinancials-swing.git/commitdiff
Added a lot trace messages + sanity checks for null references and such things
authorRoland Haeder <roland@mxchange.org>
Tue, 28 Jul 2015 13:27:51 +0000 (15:27 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 28 Jul 2015 13:27:51 +0000 (15:27 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

20 files changed:
Addressbook/src/org/mxchange/addressbook/application/AddressbookApplication.java
Addressbook/src/org/mxchange/addressbook/client/BaseClient.java
Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java
Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java
Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java
Addressbook/src/org/mxchange/addressbook/contact/BaseContact.java
Addressbook/src/org/mxchange/addressbook/contact/user/UserContact.java
Addressbook/src/org/mxchange/addressbook/database/backend/csv/Base64CsvDatabaseBackend.java
Addressbook/src/org/mxchange/addressbook/database/frontend/BaseDatabaseFrontend.java
Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactDatabaseFrontend.java
Addressbook/src/org/mxchange/addressbook/manager/application/ApplicationManager.java
Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java
Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java
Addressbook/src/org/mxchange/addressbook/menu/AddressbookMenu.java
Addressbook/src/org/mxchange/addressbook/menu/BaseMenu.java
Addressbook/src/org/mxchange/addressbook/menu/MenuTools.java
Addressbook/src/org/mxchange/addressbook/menu/console/ConsoleMenu.java
Addressbook/src/org/mxchange/addressbook/menu/item/console/ConsoleMenuItem.java
Addressbook/src/org/mxchange/addressbook/model/BaseModel.java
Addressbook/src/org/mxchange/addressbook/model/contact/ContactTableModel.java

index 2f4f185617f6c50bc821018a211a659b7cef5805..747151264e656434a3a83523823a7e568ced81b7 100644 (file)
@@ -77,12 +77,12 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
        /**
         * Application title
         */
        /**
         * Application title
         */
-       public static final String APP_TITLE = "Adressbuch";
+       public static final String APP_TITLE = "Adressbuch"; //NOI18N
 
        /**
         * Application version
         */
 
        /**
         * Application version
         */
-       public static final String APP_VERSION = "0.0";
+       public static final String APP_VERSION = "0.0"; //NOI18N
 
        /**
         * Self instance
 
        /**
         * Self instance
@@ -113,7 +113,7 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
         * @return A printable name
         */
        public static String printableTitle () {
         * @return A printable name
         */
        public static String printableTitle () {
-               return MessageFormat.format("{0} v{1}", APP_TITLE, APP_VERSION);
+               return MessageFormat.format("{0} v{1}", APP_TITLE, APP_VERSION); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -121,7 +121,7 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
         */
        @Override
        public void doBootstrap () {
         */
        @Override
        public void doBootstrap () {
-               this.getLogger().debug("Initializing application ...");
+               this.getLogger().debug("Initializing application ..."); //NOI18N
 
                // Init client variable
                Client client = null;
 
                // Init client variable
                Client client = null;
@@ -129,19 +129,19 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
                // Is console or Swing choosen?
                if (this.isConsole()) {
                        // Debug message
                // Is console or Swing choosen?
                if (this.isConsole()) {
                        // Debug message
-                       this.getLogger().debug("Initializing console client ...");
+                       this.getLogger().debug("Initializing console client ..."); //NOI18N
 
                        // Init console client instance
                        client = new ConsoleClient(this);
                } else if (this.isGui()) {
                        // Debug message
 
                        // Init console client instance
                        client = new ConsoleClient(this);
                } else if (this.isGui()) {
                        // Debug message
-                       this.getLogger().debug("Initializing GUI (Swing) client ...");
+                       this.getLogger().debug("Initializing GUI (Swing) client ..."); //NOI18N
 
                        // Init console instance
                        client = new SwingClient(this);
                } else {
                        // Not client choosen
 
                        // Init console instance
                        client = new SwingClient(this);
                } else {
                        // Not client choosen
-                       this.getLogger().error("No client choosen. Cannot launch.");
+                       this.getLogger().error("No client choosen. Cannot launch."); //NOI18N
                        System.exit(1);
                }
 
                        System.exit(1);
                }
 
@@ -153,6 +153,9 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
 
                // The application is running at this point
                this.getClient().enableIsRunning();
 
                // The application is running at this point
                this.getClient().enableIsRunning();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -161,14 +164,14 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
        @Override
        public void doMainLoop () {
                // Debug message
        @Override
        public void doMainLoop () {
                // Debug message
-               this.getLogger().trace("CALLED!");
+               this.getLogger().trace("CALLED!"); //NOI18N
 
                // @TODO The application should be running now
                // Output introduction
                this.showIntro();
 
                // Set current menu to main
 
                // @TODO The application should be running now
                // Output introduction
                this.showIntro();
 
                // Set current menu to main
-               this.getClient().setCurrentMenu("main");
+               this.getClient().setCurrentMenu("main"); //NOI18N
 
                // --- Main loop starts here ---
                while (this.getClient().isRunning()) {
 
                // --- Main loop starts here ---
                while (this.getClient().isRunning()) {
@@ -192,14 +195,14 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
        // --- Main loop ends here ---
 
                // Debug message
        // --- Main loop ends here ---
 
                // Debug message
-               this.getLogger().debug("Main loop exit - shutting down ...");
+               this.getLogger().debug("Main loop exit - shutting down ..."); //NOI18N
        }
 
        /**
         * Enables console client by setting propper flag
         */
        private void enableConsoleClient () {
        }
 
        /**
         * Enables console client by setting propper flag
         */
        private void enableConsoleClient () {
-               this.getLogger().debug("Enabling console client (may become optional client) ...");
+               this.getLogger().debug("Enabling console client (may become optional client) ..."); //NOI18N
                this.consoleClient = true;
                this.guiClient = false;
        }
                this.consoleClient = true;
                this.guiClient = false;
        }
@@ -208,7 +211,7 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
         * Enables GUI client by setting propper flag
         */
        private void enableGuiClient () {
         * Enables GUI client by setting propper flag
         */
        private void enableGuiClient () {
-               this.getLogger().debug("Enabling GUI client (may become new default client) ...");
+               this.getLogger().debug("Enabling GUI client (may become new default client) ..."); //NOI18N
                this.consoleClient = false;
                this.guiClient = true;
        }
                this.consoleClient = false;
                this.guiClient = true;
        }
@@ -239,17 +242,20 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
         * @param args Arguments from program launch
         */
        private void parseArguments (final String[] args) {
         * @param args Arguments from program launch
         */
        private void parseArguments (final String[] args) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("args()={0} - CALLED!", args.length)); //NOI18N
+
                // Debug message
                // Debug message
-               this.getLogger().debug(MessageFormat.format("Parsing {0} arguments ...", args.length));
+               this.getLogger().debug(MessageFormat.format("Parsing {0} arguments ...", args.length)); //NOI18N
 
                for (final String arg : args) {
                        // Switch on it
                        switch (arg) {
 
                for (final String arg : args) {
                        // Switch on it
                        switch (arg) {
-                               case "-console":
+                               case "-console": //NOI18N
                                        enableConsoleClient();
                                        break;
 
                                        enableConsoleClient();
                                        break;
 
-                               case "-gui":
+                               case "-gui": //NOI18N
                                        enableGuiClient();
                                        break;
                        }
                                        enableGuiClient();
                                        break;
                        }
@@ -260,8 +266,14 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
         * Show introduction which depends on client
         */
        private void showIntro () {
         * Show introduction which depends on client
         */
        private void showIntro () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Let the client show it
                this.getClient().showWelcome();
                // Let the client show it
                this.getClient().showWelcome();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -270,7 +282,7 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
         * @param args Arguments handled to program
         */
        private void start (final String args[]) {
         * @param args Arguments handled to program
         */
        private void start (final String args[]) {
-               this.getLogger().info("Program is started.");
+               this.getLogger().info("Program is started."); //NOI18N
 
                // Parse arguments
                this.parseArguments(args);
 
                // Parse arguments
                this.parseArguments(args);
@@ -279,7 +291,7 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
                ApplicationManager.getManager(this).start();
 
                // Good bye, but this should not be reached ...
                ApplicationManager.getManager(this).start();
 
                // Good bye, but this should not be reached ...
-               this.getLogger().warn("Unusual exit reached.");
+               this.getLogger().warn("Unusual exit reached."); //NOI18N
                this.doShutdown();
        }
 
                this.doShutdown();
        }
 
@@ -298,10 +310,13 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
         */
        @Override
        public void doShutdown () {
         */
        @Override
        public void doShutdown () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Shutdown client
                this.getClient().doShutdown();
 
                // Shutdown client
                this.getClient().doShutdown();
 
-               this.getLogger().info("End of program (last line)");
+               this.getLogger().info("End of program (last line)"); //NOI18N
                System.exit(0);
        }
 
                System.exit(0);
        }
 
index 54d8bc32aad56c692a561fb867d766e523829b07..6bd281fe265568813d711d2e97e48f68cba502f4 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.client;
 
  */
 package org.mxchange.addressbook.client;
 
+import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Map;
 import org.mxchange.addressbook.BaseFrameworkSystem;
 import java.util.HashMap;
 import java.util.Map;
 import org.mxchange.addressbook.BaseFrameworkSystem;
@@ -59,11 +60,17 @@ public abstract class BaseClient extends BaseFrameworkSystem {
         * Shutdown method for all clients
         */
        public void doShutdown () {
         * Shutdown method for all clients
         */
        public void doShutdown () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Disable client
                this.disableIsRunning();
 
                // Shuts down contact manager
                this.getContactManager().doShutdown();
                // Disable client
                this.disableIsRunning();
 
                // Shuts down contact manager
                this.getContactManager().doShutdown();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -147,6 +154,9 @@ public abstract class BaseClient extends BaseFrameworkSystem {
         * Initializes contact manager
         */
        protected void initContactManager () {
         * Initializes contact manager
         */
        protected void initContactManager () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Debug message
                this.getLogger().debug("Initializing contact manager ...");
 
                // Debug message
                this.getLogger().debug("Initializing contact manager ...");
 
@@ -159,6 +169,9 @@ public abstract class BaseClient extends BaseFrameworkSystem {
 
                // Debug message
                this.getLogger().debug("Contact manager has been initialized.");
 
                // Debug message
                this.getLogger().debug("Contact manager has been initialized.");
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -167,6 +180,9 @@ public abstract class BaseClient extends BaseFrameworkSystem {
         * @param menuType Given menu to show
         */
        protected void showMenu (final String menuType) {
         * @param menuType Given menu to show
         */
        protected void showMenu (final String menuType) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("menuType={0} - CALLED!", menuType)); //NOI18N
+
                Menu menu = this.getMenu(menuType);
 
                // Is the menu set?
                Menu menu = this.getMenu(menuType);
 
                // Is the menu set?
@@ -178,5 +194,8 @@ public abstract class BaseClient extends BaseFrameworkSystem {
 
                // Show menu
                menu.show((Client) this);
 
                // Show menu
                menu.show((Client) this);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
        }
 }
index 9de67f1a2787a11e439683e57506bbed96c9f089..bbefa9e05969d8e0faba7ba3c0ca2ea817fd778e 100644 (file)
@@ -51,13 +51,17 @@ public class ConsoleClient extends BaseClient implements Client {
         * @param application An instance of an Application class
         */
        public ConsoleClient (final Application application) {
         * @param application An instance of an Application class
         */
        public ConsoleClient (final Application application) {
-               super();
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("application={0} - CALLED!", application)); //NOI18N
 
                // Set application instance
                this.setApplication(application);
 
                // Init scanner instance
                this.scanner = new Scanner(System.in);
 
                // Set application instance
                this.setApplication(application);
 
                // Init scanner instance
                this.scanner = new Scanner(System.in);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -67,8 +71,20 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        public void displayAddressBox (final Contact contact) {
         */
        @Override
        public void displayAddressBox (final Contact contact) {
+               // Trace message
+               this.getLogger().trace("contact=" + contact + " - CALLED!"); //NOI18N
+
+               // Is it null?
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null");
+               }
+
                // Simple display ...
                this.outputMessage(MessageFormat.format("Strasse, PLZ Ort, Land: {0}\n{1} {2}\n{3}", contact.getStreet(), contact.getZipCode(), contact.getCity(), contact.getCountryCode()));
                // Simple display ...
                this.outputMessage(MessageFormat.format("Strasse, PLZ Ort, Land: {0}\n{1} {2}\n{3}", contact.getStreet(), contact.getZipCode(), contact.getCity(), contact.getCountryCode()));
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -78,6 +94,15 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        public void displayNameBox (final Contact contact) {
         */
        @Override
        public void displayNameBox (final Contact contact) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
+
+               // Is it null?
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null");
+               }
+
                // Get translated gender as the user may want to see "Mr.", "Mrs."
                String gender = contact.getTranslatedGender();
 
                // Get translated gender as the user may want to see "Mr.", "Mrs."
                String gender = contact.getTranslatedGender();
 
@@ -93,6 +118,9 @@ public class ConsoleClient extends BaseClient implements Client {
                        // Company contact
                        this.outputMessage(MessageFormat.format("Firma: {0}\nAnsprechpartner: {1} {2} {3}", companyName, gender, contact.getSurname(), contact.getFamilyName()));
                }
                        // Company contact
                        this.outputMessage(MessageFormat.format("Firma: {0}\nAnsprechpartner: {1} {2} {3}", companyName, gender, contact.getSurname(), contact.getFamilyName()));
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -102,12 +130,33 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        public void displayOtherDataBox (final Contact contact) {
         */
        @Override
        public void displayOtherDataBox (final Contact contact) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
+
+               // Is it null?
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null");
+               }
+
                // Cellphone and such ...
                this.outputMessage(MessageFormat.format("Telefonnumer: {0}\nFaxnummer: {1}\nHandy: {2}\nKommentar:\n{3}", contact.getPhoneNumber(), contact.getFaxNumber(), contact.getCellphoneNumber(), contact.getComment()));
                // Cellphone and such ...
                this.outputMessage(MessageFormat.format("Telefonnumer: {0}\nFaxnummer: {1}\nHandy: {2}\nKommentar:\n{3}", contact.getPhoneNumber(), contact.getFaxNumber(), contact.getCellphoneNumber(), contact.getComment()));
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        @Override
        public void doChangeOwnAddressData (final Contact contact) {
        }
 
        @Override
        public void doChangeOwnAddressData (final Contact contact) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
+
+               // Is it null?
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null");
+               }
+
                // Make sure it is own contact
                if (!contact.isOwnContact()) {
                        // Not own contact
                // Make sure it is own contact
                if (!contact.isOwnContact()) {
                        // Not own contact
@@ -128,10 +177,22 @@ public class ConsoleClient extends BaseClient implements Client {
 
                // Update address data
                contact.updateAddressData(street, zipCode, city, countryCode);
 
                // Update address data
                contact.updateAddressData(street, zipCode, city, countryCode);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        @Override
        public void doChangeOwnNameData (final Contact contact) {
        }
 
        @Override
        public void doChangeOwnNameData (final Contact contact) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
+
+               // Is it null?
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null");
+               }
+
                // Make sure it is own contact
                if (!contact.isOwnContact()) {
                        // Not own contact
                // Make sure it is own contact
                if (!contact.isOwnContact()) {
                        // Not own contact
@@ -152,10 +213,22 @@ public class ConsoleClient extends BaseClient implements Client {
 
                // Update contact instance
                contact.updateNameData(gender, surname, familyName, companyName);
 
                // Update contact instance
                contact.updateNameData(gender, surname, familyName, companyName);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        @Override
        public void doChangeOwnOtherData (final Contact contact) {
        }
 
        @Override
        public void doChangeOwnOtherData (final Contact contact) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
+
+               // Is it null?
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null");
+               }
+
                // Make sure it is own contact
                if (!contact.isOwnContact()) {
                        // Not own contact
                // Make sure it is own contact
                if (!contact.isOwnContact()) {
                        // Not own contact
@@ -179,10 +252,16 @@ public class ConsoleClient extends BaseClient implements Client {
 
                // Update contact instance
                contact.updateOtherData(phoneNumber, cellNumber, faxNumber, email, null, comment);
 
                // Update contact instance
                contact.updateOtherData(phoneNumber, cellNumber, faxNumber, email, null, comment);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        @Override
        public Contact doEnterOwnData () {
        }
 
        @Override
        public Contact doEnterOwnData () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // First ask for gender
                Gender gender = this.getContactManager().enterOwnGender();
 
                // First ask for gender
                Gender gender = this.getContactManager().enterOwnGender();
 
@@ -198,6 +277,9 @@ public class ConsoleClient extends BaseClient implements Client {
                // Construct UserContact instance
                Contact contact = new UserContact(gender, surname, familyName, companyName);
 
                // Construct UserContact instance
                Contact contact = new UserContact(gender, surname, familyName, companyName);
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} - EXIT!", contact)); //NOI18N
+
                // And return object
                return contact;
        }
                // And return object
                return contact;
        }
@@ -207,14 +289,23 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        public void doShutdown () {
         */
        @Override
        public void doShutdown () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Parent call
                super.doShutdown();
 
                // @TODO Add other shutdown stuff
                // Parent call
                super.doShutdown();
 
                // @TODO Add other shutdown stuff
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        @Override
        public void doUserMenuChoice () throws UnhandledUserChoiceException {
        }
 
        @Override
        public void doUserMenuChoice () throws UnhandledUserChoiceException {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Get all access keys from menu
                char[] accessKeys = MenuTools.getAccessKeysFromMenuMap(this.getMenus(), this.getCurrentMenu());
 
                // Get all access keys from menu
                char[] accessKeys = MenuTools.getAccessKeysFromMenuMap(this.getMenus(), this.getCurrentMenu());
 
@@ -259,6 +350,9 @@ public class ConsoleClient extends BaseClient implements Client {
                                // @TODO throw own exception
                                throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));
                }
                                // @TODO throw own exception
                                throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -270,6 +364,18 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        public char enterChar (final char[] validChars, final String message) {
         */
        @Override
        public char enterChar (final char[] validChars, final String message) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("validChars={0},message={1} - CALLED!", Arrays.toString(validChars), message)); //NOI18N
+
+               // The validChars must not null be null and filled with at least one char
+               if (validChars == null) {
+                       // Is null
+                       throw new NullPointerException("validChars is null");
+               } else if (validChars.length == 0) {
+                       // Is not filled
+                       throw new IllegalArgumentException("validChars is not filled.");
+               }
+
                char input = 0;
 
                // Sort array, else binarySearch() won't work
                char input = 0;
 
                // Sort array, else binarySearch() won't work
@@ -284,6 +390,9 @@ public class ConsoleClient extends BaseClient implements Client {
                        input = this.readChar();
                }
 
                        input = this.readChar();
                }
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N
+
                // Return read char
                return input;
        }
                // Return read char
                return input;
        }
@@ -296,6 +405,9 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        public Gender enterGender (final String message) {
         */
        @Override
        public Gender enterGender (final String message) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("message={0} - CALLED!", message)); //NOI18N
+
                // Get valid chars
                char[] validChars = Gender.validChars();
 
                // Get valid chars
                char[] validChars = Gender.validChars();
 
@@ -307,6 +419,12 @@ public class ConsoleClient extends BaseClient implements Client {
                // Now get a Gender instance back
                Gender g = Gender.fromChar(gender);
 
                // Now get a Gender instance back
                Gender g = Gender.fromChar(gender);
 
+               // g must not be null
+               assert(g instanceof Gender) : "g is not set.";
+
+               // Trace message
+               this.getLogger().trace("g=" + g + " - EXIT!"); //NOI18N
+
                // Return it
                return g;
        }
                // Return it
                return g;
        }
@@ -321,6 +439,9 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        public int enterInt (final int minimum, final int maximum, final String message) {
         */
        @Override
        public int enterInt (final int minimum, final int maximum, final String message) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("minimum={0},maximum={1},message={2} - CALLED!", minimum, maximum, message)); //NOI18N
+
                // Minimum should not be below zero
                assert (minimum >= 0);
                assert (maximum > minimum);
                // Minimum should not be below zero
                assert (minimum >= 0);
                assert (maximum > minimum);
@@ -336,6 +457,9 @@ public class ConsoleClient extends BaseClient implements Client {
                        input = this.readInt();
                }
 
                        input = this.readInt();
                }
 
+               // Trace message
+               this.getLogger().trace("input=" + input + " - EXIT!"); //NOI18N
+
                // Return it
                return input;
        }
                // Return it
                return input;
        }
@@ -351,6 +475,9 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
         */
        @Override
        public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("minLength={0},maxLength={1},message={2}allowEmpty={3} - CALLED!", minLength, maxLength, message, allowEmpty)); //NOI18N
+
                // Check on length, e.g. country codes are excactly 2 chars long
                assert (maxLength >= minLength);
 
                // Check on length, e.g. country codes are excactly 2 chars long
                assert (maxLength >= minLength);
 
@@ -366,6 +493,9 @@ public class ConsoleClient extends BaseClient implements Client {
                        input = this.readString();
                }
 
                        input = this.readString();
                }
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N
+
                // Return it
                return input;
        }
                // Return it
                return input;
        }
@@ -389,11 +519,17 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        public void init () {
         */
        @Override
        public void init () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Init contact manager here
                this.initContactManager();
 
                // Fill menu map
                this.fillMenuMap();
                // Init contact manager here
                this.initContactManager();
 
                // Fill menu map
                this.fillMenuMap();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -440,21 +576,30 @@ public class ConsoleClient extends BaseClient implements Client {
 
        @Override
        public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
 
        @Override
        public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
+
+               // Contact must not be null
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null");
+               }
+
                // Ask the user for editing [name], [a]ddress or [other] data
                char choice = this.enterChar(new char[] {'n', 'a', 'o', 'x'}, "Welchen Daten möchten Sie ändern? (n=Namensdaten, a=Anschriftsdaten, o=Andere, x=Zurück zur Hauptauswahl) ");
 
                // @TODO Get rid of this ugly switch block, too
                switch (choice) {
                        case 'n': // Name data
                // Ask the user for editing [name], [a]ddress or [other] data
                char choice = this.enterChar(new char[] {'n', 'a', 'o', 'x'}, "Welchen Daten möchten Sie ändern? (n=Namensdaten, a=Anschriftsdaten, o=Andere, x=Zurück zur Hauptauswahl) ");
 
                // @TODO Get rid of this ugly switch block, too
                switch (choice) {
                        case 'n': // Name data
-                               this.getContactManager().doChangeNameData(contact, this);
+                               this.getContactManager().doChangeNameData(contact);
                                break;
 
                        case 'a': // Address data
                                break;
 
                        case 'a': // Address data
-                               this.getContactManager().doChangeAddressData(contact, this);
+                               this.getContactManager().doChangeAddressData(contact);
                                break;
 
                        case 'o': // Other data
                                break;
 
                        case 'o': // Other data
-                               this.getContactManager().doChangeOtherData(contact, this);
+                               this.getContactManager().doChangeOtherData(contact);
                                break;
 
                        case 'x': // Exit this menu
                                break;
 
                        case 'x': // Exit this menu
@@ -465,6 +610,9 @@ public class ConsoleClient extends BaseClient implements Client {
                                // @TODO throw own exception
                                throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));
                }
                                // @TODO throw own exception
                                throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -524,10 +672,16 @@ public class ConsoleClient extends BaseClient implements Client {
         */
        @Override
        protected final void fillMenuMap () {
         */
        @Override
        protected final void fillMenuMap () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Initialize first (main) menu
                Menu menu = new ConsoleMenu("main", this);
 
                // Add it
                this.getMenus().put("main", menu);
                // Initialize first (main) menu
                Menu menu = new ConsoleMenu("main", this);
 
                // Add it
                this.getMenus().put("main", menu);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
        }
 }
index ea74026336507034521e9e9ae1c67eebd33d29b8..4a7a9c8a85e5abd99c433d576a4d409788f4a70a 100644 (file)
@@ -139,10 +139,16 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // Set client here
                this.setClient(client);
 
                // Set client here
                this.setClient(client);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        @Override
        public Contact doEnterOwnData () {
        }
 
        @Override
        public Contact doEnterOwnData () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Is the "add contact" window visible?
                if (this.addContact.isVisible()) {
                        // Something bad happened
                // Is the "add contact" window visible?
                if (this.addContact.isVisible()) {
                        // Something bad happened
@@ -155,6 +161,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                // Make other window visible
                this.addContact.setVisible(true);
 
                // Make other window visible
                this.addContact.setVisible(true);
 
+               // Trace message
+               this.getLogger().trace("Returning null : EXIT!"); //NOI18N
+
                // Return value is not supported
                return null;
        }
                // Return value is not supported
                return null;
        }
@@ -164,8 +173,14 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        @Override
        public void doShutdown () {
         */
        @Override
        public void doShutdown () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // First only show shutdown status
                this.updateStatus("shutdown"); //NOI18N
                // First only show shutdown status
                this.updateStatus("shutdown"); //NOI18N
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
 
        }
 
 
@@ -174,11 +189,17 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        @Override
        public void enableMainWindow () {
         */
        @Override
        public void enableMainWindow () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Enable it again
                this.frame.setEnabled(true);
 
                // Request focus for this window
                this.frame.requestFocus();
                // Enable it again
                this.frame.setEnabled(true);
 
                // Request focus for this window
                this.frame.requestFocus();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -208,6 +229,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // All done here
                this.updateStatus("done"); //NOI18N
 
                // All done here
                this.updateStatus("done"); //NOI18N
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -235,6 +259,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // Set flag
                this.isInitialized = true;
 
                // Set flag
                this.isInitialized = true;
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -253,13 +280,21 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        @Override
        public void shutdownApplication () {
         */
        @Override
        public void shutdownApplication () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // To do this, the frame must be initialized
                if (!this.isInitialized()) {
                        // Not initalized, so bad call
                        this.getLogger().fatal("Bad call of shutdownApplication(). Please report this."); //NOI18N
                        return;
                }
                // To do this, the frame must be initialized
                if (!this.isInitialized()) {
                        // Not initalized, so bad call
                        this.getLogger().fatal("Bad call of shutdownApplication(). Please report this."); //NOI18N
                        return;
                }
+
+               // Call shutdown method
                this.getClient().getApplication().doShutdown();
                this.getClient().getApplication().doShutdown();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -304,6 +339,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         * Initializes "add contact" dialog
         */
        private void initAddContactDialog () {
         * Initializes "add contact" dialog
         */
        private void initAddContactDialog () {
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+
                // Instance dialog and set title
                this.addContact = new JDialog();
                this.addContact.setTitle(this.generateFrameTitle("dialog.addContact")); //NOI18N
                // Instance dialog and set title
                this.addContact = new JDialog();
                this.addContact.setTitle(this.generateFrameTitle("dialog.addContact")); //NOI18N
@@ -366,6 +404,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // x)Only for developing:
                /* DEBUG: */ this.addContact.setVisible(true);
 
                // x)Only for developing:
                /* DEBUG: */ this.addContact.setVisible(true);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -374,6 +415,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         * @param dialog A JDialog instance to this components to
         */
        private void initAddressDataPanel (final JDialog dialog) {
         * @param dialog A JDialog instance to this components to
         */
        private void initAddressDataPanel (final JDialog dialog) {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Panel "address" input boxes
                JPanel addressPanel = new JPanel();
                addressPanel.setLayout(new BoxLayout(addressPanel, BoxLayout.Y_AXIS));
                // Panel "address" input boxes
                JPanel addressPanel = new JPanel();
                addressPanel.setLayout(new BoxLayout(addressPanel, BoxLayout.Y_AXIS));
@@ -502,6 +546,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // Add panel to dialog
                dialog.add(addressPanel);
 
                // Add panel to dialog
                dialog.add(addressPanel);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -556,12 +603,18 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // Init other windows
                initOtherDialogs();
 
                // Init other windows
                initOtherDialogs();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
         * Initializes the menu system
         */
        private void initMenuSystem () {
        }
 
        /**
         * Initializes the menu system
         */
        private void initMenuSystem () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Init menu bar, menu and item instances
                JMenuBar menuBar = new JMenuBar();
                JMenu menu;
                // Init menu bar, menu and item instances
                JMenuBar menuBar = new JMenuBar();
                JMenu menu;
@@ -644,6 +697,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // Add menu bar -> frame
                this.frame.add(menuBar, BorderLayout.NORTH);
 
                // Add menu bar -> frame
                this.frame.add(menuBar, BorderLayout.NORTH);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -652,6 +708,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         * @param dialog A JDialog instance to this components to
         */
        private void initNameDataPanel (final JDialog dialog) {
         * @param dialog A JDialog instance to this components to
         */
        private void initNameDataPanel (final JDialog dialog) {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Panel "name" input boxes
                JPanel namePanel = new JPanel();
                namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.Y_AXIS));
                // Panel "name" input boxes
                JPanel namePanel = new JPanel();
                namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.Y_AXIS));
@@ -718,6 +777,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // Finally add panel to dialog
                dialog.add(namePanel);
 
                // Finally add panel to dialog
                dialog.add(namePanel);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -727,6 +789,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         * @todo Fill this with life
         */
        private void initOtherDataPanel (final JDialog dialog) {
         * @todo Fill this with life
         */
        private void initOtherDataPanel (final JDialog dialog) {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Panel "other" input boxes
                JPanel otherPanel = new JPanel();
                otherPanel.setLayout(new BoxLayout(otherPanel, BoxLayout.Y_AXIS));
                // Panel "other" input boxes
                JPanel otherPanel = new JPanel();
                otherPanel.setLayout(new BoxLayout(otherPanel, BoxLayout.Y_AXIS));
@@ -736,21 +801,33 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // Finally add panel to dialog
                dialog.add(otherPanel);
 
                // Finally add panel to dialog
                dialog.add(otherPanel);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
         * Initialize other dialogs (e.g. "Add contact")
         */
        private void initOtherDialogs () {
        }
 
        /**
         * Initialize other dialogs (e.g. "Add contact")
         */
        private void initOtherDialogs () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Init other windows:
                // 1) Add contact
                initAddContactDialog();
                // Init other windows:
                // 1) Add contact
                initAddContactDialog();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
         * Initializes status panel
         */
        private void initStatusPanel () {
        }
 
        /**
         * Initializes status panel
         */
        private void initStatusPanel () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Init status label (which needs to be updated
                this.statusLabel = new JLabel();
                this.updateStatus("initializing"); //NOI18N
                // Init status label (which needs to be updated
                this.statusLabel = new JLabel();
                this.updateStatus("initializing"); //NOI18N
@@ -763,12 +840,18 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // Add panel to frame
                this.frame.add(panel, BorderLayout.SOUTH);
 
                // Add panel to frame
                this.frame.add(panel, BorderLayout.SOUTH);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
         * Initializes the table which will show all contacts
         */
        private void initTable () {
        }
 
        /**
         * Initializes the table which will show all contacts
         */
        private void initTable () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Instance table model
                this.dataModel = new ContactTableModel(this.getClient());
 
                // Instance table model
                this.dataModel = new ContactTableModel(this.getClient());
 
@@ -798,6 +881,9 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
 
                // Add pane to frame
                this.frame.add(scroller, BorderLayout.CENTER);
 
                // Add pane to frame
                this.frame.add(scroller, BorderLayout.CENTER);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -806,7 +892,13 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         * @param type Status type
         */
        private void updateStatus (final String type) {
         * @param type Status type
         */
        private void updateStatus (final String type) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("type={0} - CALLED!", type)); //NOI18N
+
                // Set status message
                this.statusLabel.setText(this.getBundle().getString(String.format("AddressbookFrame.statusLabel.%s.text", type))); //NOI18N
                // Set status message
                this.statusLabel.setText(this.getBundle().getString(String.format("AddressbookFrame.statusLabel.%s.text", type))); //NOI18N
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
        }
 }
index a8c1a72910e14f39b1de5455d4bc296a475e96a5..8bad87a7dbdb0e3341076b93fae27aab7537d92a 100644 (file)
@@ -43,8 +43,6 @@ public class SwingClient extends BaseClient implements Client {
         * @param application Application instance
         */
        public SwingClient (final Application application) {
         * @param application Application instance
         */
        public SwingClient (final Application application) {
-               super();
-
                // Debug message
                this.getLogger().trace("CALLED!"); //NOI18N
 
                // Debug message
                this.getLogger().trace("CALLED!"); //NOI18N
 
@@ -53,6 +51,9 @@ public class SwingClient extends BaseClient implements Client {
 
                // Init frame instance
                this.frame = AddressbookFrame.getSelfInstance(this);
 
                // Init frame instance
                this.frame = AddressbookFrame.getSelfInstance(this);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        @Override
        }
 
        @Override
@@ -92,6 +93,9 @@ public class SwingClient extends BaseClient implements Client {
         */
        @Override
        public Contact doEnterOwnData () {
         */
        @Override
        public Contact doEnterOwnData () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Deligate this call to the frame
                return this.frame.doEnterOwnData();
        }
                // Deligate this call to the frame
                return this.frame.doEnterOwnData();
        }
@@ -197,7 +201,7 @@ public class SwingClient extends BaseClient implements Client {
 
        @Override
        public void showCurrentMenu () {
 
        @Override
        public void showCurrentMenu () {
-       // Debug message
+               // Debug message
                //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
 
                // Not implemented here
                //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
 
                // Not implemented here
index 42be4d329675aca8ce004011c09a85adeb1a8d75..40326c3e27de08b6ee110462929149c809c5c555 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.contact;
 
  */
 package org.mxchange.addressbook.contact;
 
+import java.text.MessageFormat;
 import java.util.Objects;
 import org.mxchange.addressbook.BaseFrameworkSystem;
 import org.mxchange.addressbook.client.Client;
 import java.util.Objects;
 import org.mxchange.addressbook.BaseFrameworkSystem;
 import org.mxchange.addressbook.client.Client;
@@ -124,7 +125,7 @@ public class BaseContact extends BaseFrameworkSystem {
         * @todo Needs a lot improvements
         */
        @Override
         * @todo Needs a lot improvements
         */
        @Override
-       public boolean equals (Object object) {
+       public boolean equals (final Object object) {
                // Is it same type?
                if (!(object instanceof BaseContact)) {
                        // Not equal types
                // Is it same type?
                if (!(object instanceof BaseContact)) {
                        // Not equal types
@@ -239,9 +240,12 @@ public class BaseContact extends BaseFrameworkSystem {
         * @return "CSV-serialized" version of the stored data
         */
        public String getCsvStringFromStoreableObject () {
         * @return "CSV-serialized" version of the stored data
         */
        public String getCsvStringFromStoreableObject () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Get all together
                String csvString = String.format(
                // Get all together
                String csvString = String.format(
-                               "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"\n",
+                               "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"",
                                this.isOwnContact(),
                                this.getGender().getDatabaseValue(),
                                this.getSurname(),
                                this.isOwnContact(),
                                this.getGender().getDatabaseValue(),
                                this.getSurname(),
@@ -457,6 +461,15 @@ public class BaseContact extends BaseFrameworkSystem {
         * @param client Client instance to use
         */
        public void show (final Client client) {
         * @param client Client instance to use
         */
        public void show (final Client client) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("client={0} - CALLED!", client)); //NOI18N
+
+               // The client must be set
+               if (client == null) {
+                       // Not set
+                       throw new NullPointerException("client is null");
+               }
+
                // Display name "box"
                client.displayNameBox((Contact) this);
 
                // Display name "box"
                client.displayNameBox((Contact) this);
 
@@ -476,6 +489,9 @@ public class BaseContact extends BaseFrameworkSystem {
         * @param countryCode Country code
         */
        public void updateAddressData (final String street, final long zipCode, final String city, final String countryCode) {
         * @param countryCode Country code
         */
        public void updateAddressData (final String street, final long zipCode, final String city, final String countryCode) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("street={0},zipCode={1},city={2},countryCode={3} - CALLED!", street, zipCode, city, countryCode)); //NOI18N
+
                // Set all
                if (street != null) {
                        this.setStreet(street);
                // Set all
                if (street != null) {
                        this.setStreet(street);
@@ -489,6 +505,9 @@ public class BaseContact extends BaseFrameworkSystem {
                if (countryCode != null) {
                        this.setCountryCode(countryCode);
                }
                if (countryCode != null) {
                        this.setCountryCode(countryCode);
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -500,6 +519,9 @@ public class BaseContact extends BaseFrameworkSystem {
         * @param companyName Company name
         */
        public void updateNameData (final Gender gender, final String surname, final String familyName, final String companyName) {
         * @param companyName Company name
         */
        public void updateNameData (final Gender gender, final String surname, final String familyName, final String companyName) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("gender={0},surname={1},familyName={2},companyName={3} - CALLED!", gender, surname, familyName, companyName)); //NOI18N
+
                // Set all
                this.setGender(gender);
 
                // Set all
                this.setGender(gender);
 
@@ -512,6 +534,9 @@ public class BaseContact extends BaseFrameworkSystem {
                if (companyName != null) {
                        this.setCompanyName(companyName);
                }
                if (companyName != null) {
                        this.setCompanyName(companyName);
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -525,6 +550,9 @@ public class BaseContact extends BaseFrameworkSystem {
         * @param comment Comments
         */
        public void updateOtherData (final String phoneNumber, final String cellphoneNumber, final String faxNumber, final String emailAddress, final String birthday, final String comment) {
         * @param comment Comments
         */
        public void updateOtherData (final String phoneNumber, final String cellphoneNumber, final String faxNumber, final String emailAddress, final String birthday, final String comment) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("phoneNumber={0},cellphoneNumber={1}faxNumber={2},emailAddress={3},birthday={4},comment={5} - CALLED!", phoneNumber, cellphoneNumber, faxNumber, emailAddress, birthday, comment)); //NOI18N
+
                // Set all
                if (phoneNumber != null) {
                        this.setPhoneNumber(phoneNumber);
                // Set all
                if (phoneNumber != null) {
                        this.setPhoneNumber(phoneNumber);
@@ -544,6 +572,9 @@ public class BaseContact extends BaseFrameworkSystem {
                if (comment != null) {
                        this.setComment(comment);
                }
                if (comment != null) {
                        this.setComment(comment);
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
index fd6637e1d05fbdd041b30c6585461da13e36a184..9208a067ed7cbd915ac7c5732084092f2eed4d8b 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.contact.user;
 
  */
 package org.mxchange.addressbook.contact.user;
 
+import java.text.MessageFormat;
 import org.mxchange.addressbook.contact.Contact;
 import org.mxchange.addressbook.contact.Gender;
 import org.mxchange.addressbook.contact.book.BookContact;
 import org.mxchange.addressbook.contact.Contact;
 import org.mxchange.addressbook.contact.Gender;
 import org.mxchange.addressbook.contact.book.BookContact;
@@ -42,8 +43,14 @@ public class UserContact extends BookContact implements Contact, StoreableCsv {
                // Make sure all constructors are called
                this();
 
                // Make sure all constructors are called
                this();
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("gender={0},surname={1},familyName={2},companyName={3} - CALLED!", gender, surname, familyName, companyName)); //NOI18N
+
                // Update all data
                this.updateNameData(gender, surname, familyName, companyName);
                // Update all data
                this.updateNameData(gender, surname, familyName, companyName);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
index b8ab55df0e93ef7289ce9508c25d52bddd0bfa35..8f2bb19984c8cedb57f74e96b28bf7910c45cc0e 100644 (file)
@@ -54,28 +54,28 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
         */
        public Base64CsvDatabaseBackend (final String tableName) {
                // Debug message
         */
        public Base64CsvDatabaseBackend (final String tableName) {
                // Debug message
-               this.getLogger().debug(MessageFormat.format("Trying to initialize table {0} ...", tableName));
+               this.getLogger().debug(MessageFormat.format("Trying to initialize table {0} ...", tableName)); //NOI18N
 
                // Set table name here, too
                this.setTableName(tableName);
 
                // Construct file name
 
                // Set table name here, too
                this.setTableName(tableName);
 
                // Construct file name
-               String fileName = String.format("data/table_%s.b64", tableName);
+               String fileName = String.format("data/table_%s.b64", tableName); //NOI18N
 
                // Debug message
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("Trying to open file {0} ...", fileName));
+               this.getLogger().debug(MessageFormat.format("Trying to open file {0} ...", fileName)); //NOI18N
 
                try {
                        // Try to initialize the storage (file instance)
 
                try {
                        // Try to initialize the storage (file instance)
-                       this.storageFile = new RandomAccessFile(fileName, "rw");
+                       this.storageFile = new RandomAccessFile(fileName, "rw"); //NOI18N
                } catch (final FileNotFoundException ex) {
                        // Did not work
                } catch (final FileNotFoundException ex) {
                        // Did not work
-                       this.getLogger().error(MessageFormat.format("File {0} cannot be opened: {1}", fileName, ex.toString()));
+                       this.getLogger().error(MessageFormat.format("File {0} cannot be opened: {1}", fileName, ex.toString())); //NOI18N
                        System.exit(1);
                }
 
                // Output message
                        System.exit(1);
                }
 
                // Output message
-               this.getLogger().debug(MessageFormat.format("Database for {0} has been initialized.", tableName));
+               this.getLogger().debug(MessageFormat.format("Database for {0} has been initialized.", tableName)); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -87,12 +87,21 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
         */
        @Override
        public Iterator<Contact> contactIterator () throws BadTokenException {
         */
        @Override
        public Iterator<Contact> contactIterator () throws BadTokenException {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                /*
                 * Then read the file into RAM (yes, not perfect for >1000 entries ...)
                 * and get a List back.
                 */
                List<Contact> list = this.readContactList();
 
                /*
                 * Then read the file into RAM (yes, not perfect for >1000 entries ...)
                 * and get a List back.
                 */
                List<Contact> list = this.readContactList();
 
+               // List must be set
+               assert (list instanceof List) : "list has not been set."; //NOI18N
+
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("list.iterator()={0} - EXIT!", list.iterator())); //NOI18N
+
                // Get iterator from list and return it
                return list.iterator();
        }
                // Get iterator from list and return it
                return list.iterator();
        }
@@ -102,6 +111,9 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
         */
        @Override
        public void doShutdown () {
         */
        @Override
        public void doShutdown () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                try {
                        // Close file
                        this.getStorageFile().close();
                try {
                        // Close file
                        this.getStorageFile().close();
@@ -109,6 +121,9 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                        this.getLogger().catching(ex);
                        System.exit(1);
                }
                        this.getLogger().catching(ex);
                        System.exit(1);
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -122,7 +137,7 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
 
                try {
                        length = this.getStorageFile().length();
 
                try {
                        length = this.getStorageFile().length();
-                       this.getLogger().debug(MessageFormat.format("length={0}", length));
+                       this.getLogger().debug(MessageFormat.format("length={0}", length)); //NOI18N
                } catch (final IOException ex) {
                        // Length cannot be determined
                        this.getLogger().catching(ex);
                } catch (final IOException ex) {
                        // Length cannot be determined
                        this.getLogger().catching(ex);
@@ -130,7 +145,7 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                }
 
                // Return result
                }
 
                // Return result
-               this.getLogger().trace(MessageFormat.format("length={0} : EXIT!", length));
+               this.getLogger().trace(MessageFormat.format("length={0} : EXIT!", length)); //NOI18N
                return length;
        }
 
                return length;
        }
 
@@ -139,7 +154,8 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
         */
        @Override
        public void rewind () {
         */
        @Override
        public void rewind () {
-               this.getLogger().trace("CALLED!");
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
 
                try {
                        // Rewind underlaying database file
 
                try {
                        // Rewind underlaying database file
@@ -149,7 +165,8 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                        System.exit(1);
                }
 
                        System.exit(1);
                }
 
-               this.getLogger().trace("EXIT!");
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -160,6 +177,15 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
         */
        @Override
        public void store (final Storeable object) throws IOException {
         */
        @Override
        public void store (final Storeable object) throws IOException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("object={0} - CALLED!", object)); //NOI18N
+
+               // Object must not be null
+               if (object == null) {
+                       // Abort here
+                       throw new NullPointerException("object is null");
+               }
+
                // Make sure the instance is there (DataOutput flawor)
                assert (this.storageFile instanceof DataOutput);
 
                // Make sure the instance is there (DataOutput flawor)
                assert (this.storageFile instanceof DataOutput);
 
@@ -170,13 +196,16 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                String str = csv.getCsvStringFromStoreableObject();
 
                // Debug message
                String str = csv.getCsvStringFromStoreableObject();
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("str({0})={1}", str.length(), str));
+               this.getLogger().debug(MessageFormat.format("str({0})={1}", str.length(), str)); //NOI18N
 
                // Encode line in BASE-64
 
                // Encode line in BASE-64
-               byte[] encoded = Base64.getEncoder().encode(str.trim().getBytes());
+               byte[] encoded = Base64.getEncoder().encode(str.getBytes());
 
                // The string is now a valid CSV string
                this.getStorageFile().write(encoded);
 
                // The string is now a valid CSV string
                this.getStorageFile().write(encoded);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -186,17 +215,20 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
         * @param list List instance
         */
        private void addContactToList (final Contact contact, final List<Contact> list) {
         * @param list List instance
         */
        private void addContactToList (final Contact contact, final List<Contact> list) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
+
                // No null here
                if (contact == null) {
                        // Throw exception
                // No null here
                if (contact == null) {
                        // Throw exception
-                       throw new NullPointerException("contact is null");
+                       throw new NullPointerException("contact is null"); //NOI18N
                } else if (list == null) {
                        // Throw exception
                } else if (list == null) {
                        // Throw exception
-                       throw new NullPointerException("list is null");
+                       throw new NullPointerException("list is null"); //NOI18N
                }
 
                // Debug message
                }
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("contact={0}", contact));
+               this.getLogger().debug(MessageFormat.format("contact={0}", contact)); //NOI18N
 
                // Is the contact read?
                if (contact instanceof Contact) {
 
                // Is the contact read?
                if (contact instanceof Contact) {
@@ -204,14 +236,17 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                        boolean added = list.add(contact);
 
                        // Debug message
                        boolean added = list.add(contact);
 
                        // Debug message
-                       this.getLogger().debug(MessageFormat.format("contact={0} added={1}", contact, added));
+                       this.getLogger().debug(MessageFormat.format("contact={0} added={1}", contact, added)); //NOI18N
 
                        // Has it been added?
                        if (!added) {
                                // Not added
 
                        // Has it been added?
                        if (!added) {
                                // Not added
-                               this.getLogger().warn("Contact object has not been added.");
+                               this.getLogger().warn("Contact object has not been added."); //NOI18N
                        }
                }
                        }
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -240,7 +275,7 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                }
 
                // Return status
                }
 
                // Return status
-               this.getLogger().trace(MessageFormat.format("isEof={0} : EXIT!", isEof));
+               this.getLogger().trace(MessageFormat.format("isEof={0} : EXIT!", isEof)); //NOI18N
                return isEof;
        }
 
                return isEof;
        }
 
@@ -251,7 +286,7 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
         * @return A list with Contact instances
         */
        private List<Contact> readContactList () throws BadTokenException {
         * @return A list with Contact instances
         */
        private List<Contact> readContactList () throws BadTokenException {
-               this.getLogger().trace("CALLED!");
+               this.getLogger().trace("CALLED!"); //NOI18N
 
                // First rewind
                this.rewind();
 
                // First rewind
                this.rewind();
@@ -260,7 +295,7 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                int lines = Math.round(this.length() / 140 + 0.5f);
 
                // Debug message
                int lines = Math.round(this.length() / 140 + 0.5f);
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("lines={0}", lines));
+               this.getLogger().debug(MessageFormat.format("lines={0}", lines)); //NOI18N
 
                // Instance list
                // @TODO The maximum length could be guessed from file size?
 
                // Instance list
                // @TODO The maximum length could be guessed from file size?
@@ -283,11 +318,11 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                        line = this.readLine();
 
                        // Debug message
                        line = this.readLine();
 
                        // Debug message
-                       this.getLogger().debug(MessageFormat.format("line={0}", line));
+                       this.getLogger().debug(MessageFormat.format("line={0}", line)); //NOI18N
 
                        // Then tokenize it
                        // @TODO Move this into separate method
 
                        // Then tokenize it
                        // @TODO Move this into separate method
-                       tokenizer = new StringTokenizer(line, ";");
+                       tokenizer = new StringTokenizer(line, ";"); //NOI18N
 
                        // Reset variables
                        count = 0;
 
                        // Reset variables
                        count = 0;
@@ -309,28 +344,28 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                                }
 
                                // Debug message
                                }
 
                                // Debug message
-                               this.getLogger().debug(MessageFormat.format("token={0}", token));
+                               this.getLogger().debug(MessageFormat.format("token={0}", token)); //NOI18N
 
                                // Verify token, it must have double-quotes on each side
 
                                // Verify token, it must have double-quotes on each side
-                               if ((!token.startsWith("\"")) || (!token.endsWith("\""))) {
+                               if ((!token.startsWith("\"")) || (!token.endsWith("\""))) { //NOI18N
                                        // Something bad was read
                                        // Something bad was read
-                                       throw new BadTokenException(MessageFormat.format("Token {0} at position {1} has not double-quotes on both ends.", token, count));
+                                       throw new BadTokenException(MessageFormat.format("Token {0} at position {1} has not double-quotes on both ends.", token, count)); //NOI18N
                                }
 
                                // All fine, so remove it
                                String strippedToken = token.substring(1, token.length() - 1);
 
                                // Is the string's content "null"?
                                }
 
                                // All fine, so remove it
                                String strippedToken = token.substring(1, token.length() - 1);
 
                                // Is the string's content "null"?
-                               if (strippedToken.equals("null")) {
+                               if (strippedToken.equals("null")) { //NOI18N
                                        // Debug message
                                        // Debug message
-                                       this.getLogger().debug(MessageFormat.format("strippedToken={0} - NULL!", strippedToken));
+                                       this.getLogger().debug(MessageFormat.format("strippedToken={0} - NULL!", strippedToken)); //NOI18N
 
                                        // This needs to be set to null
                                        strippedToken = null;
                                }
 
                                // Debug message
 
                                        // This needs to be set to null
                                        strippedToken = null;
                                }
 
                                // Debug message
-                               this.getLogger().debug(MessageFormat.format("strippedToken={0}", strippedToken));
+                               this.getLogger().debug(MessageFormat.format("strippedToken={0}", strippedToken)); //NOI18N
 
                                // Now, let's try a number check, if no null
                                if (strippedToken != null) {
 
                                // Now, let's try a number check, if no null
                                if (strippedToken != null) {
@@ -339,7 +374,7 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                                                num = Long.valueOf(strippedToken);
 
                                                // Debug message
                                                num = Long.valueOf(strippedToken);
 
                                                // Debug message
-                                               this.getLogger().debug(MessageFormat.format("strippedToken={0} - NUMBER!", strippedToken));
+                                               this.getLogger().debug(MessageFormat.format("strippedToken={0} - NUMBER!", strippedToken)); //NOI18N
                                        } catch (final NumberFormatException ex) {
                                                // No number, then set default
                                                num = null;
                                        } catch (final NumberFormatException ex) {
                                                // No number, then set default
                                                num = null;
@@ -347,27 +382,27 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                                }
 
                                // Now, let's try a boolean check, if no null
                                }
 
                                // Now, let's try a boolean check, if no null
-                               if ((strippedToken != null) && (num == null) && ((strippedToken.equals("true")) || (strippedToken.equals("false")))) {
+                               if ((strippedToken != null) && (num == null) && ((strippedToken.equals("true")) || (strippedToken.equals("false")))) { //NOI18N
                                        // Debug message
                                        // Debug message
-                                       this.getLogger().debug(MessageFormat.format("strippedToken={0} - BOOLEAN!", strippedToken));
+                                       this.getLogger().debug(MessageFormat.format("strippedToken={0} - BOOLEAN!", strippedToken)); //NOI18N
 
                                        // parseBoolean() is relaxed, so no exceptions
                                        bool = Boolean.valueOf(strippedToken);
                                }
 
                                // Debug message
 
                                        // parseBoolean() is relaxed, so no exceptions
                                        bool = Boolean.valueOf(strippedToken);
                                }
 
                                // Debug message
-                               this.getLogger().debug(MessageFormat.format("strippedToken={0},num={1},bool={2}", strippedToken, num, bool));
+                               this.getLogger().debug(MessageFormat.format("strippedToken={0},num={1},bool={2}", strippedToken, num, bool)); //NOI18N
 
                                // Now, let's try a gender check, if no null
 
                                // Now, let's try a gender check, if no null
-                               if ((strippedToken != null) && (num == null) && (bool == null) && ((strippedToken.equals("M")) || (strippedToken.equals("F")) || (strippedToken.equals("C")))) {
+                               if ((strippedToken != null) && (num == null) && (bool == null) && ((strippedToken.equals("M")) || (strippedToken.equals("F")) || (strippedToken.equals("C")))) { //NOI18N
                                        // Get first character
                                        gender = Gender.fromChar(strippedToken.charAt(0));
 
                                        // Debug message
                                        // Get first character
                                        gender = Gender.fromChar(strippedToken.charAt(0));
 
                                        // Debug message
-                                       this.getLogger().debug(MessageFormat.format("strippedToken={0},gender={1}", strippedToken, gender));
+                                       this.getLogger().debug(MessageFormat.format("strippedToken={0},gender={1}", strippedToken, gender)); //NOI18N
 
                                        // This instance must be there
 
                                        // This instance must be there
-                                       assert (gender instanceof Gender) : "gender is not set by Gender.fromChar(" + strippedToken + ")";
+                                       assert (gender instanceof Gender) : "gender is not set by Gender.fromChar(" + strippedToken + ")"; //NOI18N
                                }
 
                                // Now it depends on the counter which position we need to check
                                }
 
                                // Now it depends on the counter which position we need to check
@@ -376,18 +411,18 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                                                assert ((bool instanceof Boolean));
 
                                                // Debug message
                                                assert ((bool instanceof Boolean));
 
                                                // Debug message
-                                               this.getLogger().debug(MessageFormat.format("bool={0}", bool));
+                                               this.getLogger().debug(MessageFormat.format("bool={0}", bool)); //NOI18N
 
                                                // Is it own contact?
                                                if (true == bool) {
                                                        // Debug message
 
                                                // Is it own contact?
                                                if (true == bool) {
                                                        // Debug message
-                                                       this.getLogger().debug("Creating UserContact object ...");
+                                                       this.getLogger().debug("Creating UserContact object ..."); //NOI18N
 
                                                        // Own entry
                                                        contact = new UserContact();
                                                } else {
                                                        // Debug message
 
                                                        // Own entry
                                                        contact = new UserContact();
                                                } else {
                                                        // Debug message
-                                                       this.getLogger().debug("Creating BookContact object ...");
+                                                       this.getLogger().debug("Creating BookContact object ..."); //NOI18N
 
                                                        // Other contact
                                                        contact = new BookContact();
 
                                                        // Other contact
                                                        contact = new BookContact();
@@ -395,108 +430,108 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                                                break;
 
                                        case 1: // Gender
                                                break;
 
                                        case 1: // Gender
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateNameData(gender, null, null, null);
                                                break;
 
                                        case 2: // Surname
 
                                                // Update data
                                                contact.updateNameData(gender, null, null, null);
                                                break;
 
                                        case 2: // Surname
-                                               assert (contact instanceof Contact) : "First token was not boolean";
-                                               assert (gender instanceof Gender) : "gender instance is not set";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
+                                               assert (gender instanceof Gender) : "gender instance is not set"; //NOI18N
 
                                                // Update data
                                                contact.updateNameData(gender, strippedToken, null, null);
                                                break;
 
                                        case 3: // Family name
 
                                                // Update data
                                                contact.updateNameData(gender, strippedToken, null, null);
                                                break;
 
                                        case 3: // Family name
-                                               assert (contact instanceof Contact) : "First token was not boolean";
-                                               assert (gender instanceof Gender) : "gender instance is not set";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
+                                               assert (gender instanceof Gender) : "gender instance is not set"; //NOI18N
 
                                                // Update data
                                                contact.updateNameData(gender, null, strippedToken, null);
                                                break;
 
                                        case 4: // Company name
 
                                                // Update data
                                                contact.updateNameData(gender, null, strippedToken, null);
                                                break;
 
                                        case 4: // Company name
-                                               assert (contact instanceof Contact) : "First token was not boolean";
-                                               assert (gender instanceof Gender) : "gender instance is not set";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
+                                               assert (gender instanceof Gender) : "gender instance is not set"; //NOI18N
 
                                                // Update data
                                                contact.updateNameData(gender, null, null, strippedToken);
                                                break;
 
                                        case 5: // Street number
 
                                                // Update data
                                                contact.updateNameData(gender, null, null, strippedToken);
                                                break;
 
                                        case 5: // Street number
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateAddressData(strippedToken, 0, null, null);
                                                break;
 
                                        case 6: // ZIP code
 
                                                // Update data
                                                contact.updateAddressData(strippedToken, 0, null, null);
                                                break;
 
                                        case 6: // ZIP code
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateAddressData(null, num, null, null);
                                                break;
 
                                        case 7: // City name
 
                                                // Update data
                                                contact.updateAddressData(null, num, null, null);
                                                break;
 
                                        case 7: // City name
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateAddressData(null, 0, strippedToken, null);
                                                break;
 
                                        case 8: // Country code
 
                                                // Update data
                                                contact.updateAddressData(null, 0, strippedToken, null);
                                                break;
 
                                        case 8: // Country code
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateAddressData(null, 0, null, strippedToken);
                                                break;
 
                                        case 9: // Phone number
 
                                                // Update data
                                                contact.updateAddressData(null, 0, null, strippedToken);
                                                break;
 
                                        case 9: // Phone number
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateOtherData(strippedToken, null, null, null, null, null);
                                                break;
 
                                        case 10: // Fax number
 
                                                // Update data
                                                contact.updateOtherData(strippedToken, null, null, null, null, null);
                                                break;
 
                                        case 10: // Fax number
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateOtherData(null, strippedToken, null, null, null, null);
                                                break;
 
                                        case 11: // Cellphone number
 
                                                // Update data
                                                contact.updateOtherData(null, strippedToken, null, null, null, null);
                                                break;
 
                                        case 11: // Cellphone number
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateOtherData(null, null, strippedToken, null, null, null);
                                                break;
 
                                        case 12: // Email address
 
                                                // Update data
                                                contact.updateOtherData(null, null, strippedToken, null, null, null);
                                                break;
 
                                        case 12: // Email address
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateOtherData(null, null, null, strippedToken, null, null);
                                                break;
 
                                        case 13: // Birthday
 
                                                // Update data
                                                contact.updateOtherData(null, null, null, strippedToken, null, null);
                                                break;
 
                                        case 13: // Birthday
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateOtherData(null, null, null, null, strippedToken, null);
                                                break;
 
                                        case 14: // Birthday
 
                                                // Update data
                                                contact.updateOtherData(null, null, null, null, strippedToken, null);
                                                break;
 
                                        case 14: // Birthday
-                                               assert (contact instanceof Contact) : "First token was not boolean";
+                                               assert (contact instanceof Contact) : "First token was not boolean"; //NOI18N
 
                                                // Update data
                                                contact.updateOtherData(null, null, null, null, null, strippedToken);
                                                break;
 
                                        default: // New data entry
 
                                                // Update data
                                                contact.updateOtherData(null, null, null, null, null, strippedToken);
                                                break;
 
                                        default: // New data entry
-                                               this.getLogger().warn(MessageFormat.format("Will not handle unknown data {0} at index {1}", strippedToken, count));
+                                               this.getLogger().warn(MessageFormat.format("Will not handle unknown data {0} at index {1}", strippedToken, count)); //NOI18N
                                                break;
                                }
 
                                                break;
                                }
 
@@ -505,14 +540,14 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                        }
 
                        // The contact instance should be there now
                        }
 
                        // The contact instance should be there now
-                       assert (contact instanceof Contact) : "contact is not set: " + contact;
+                       assert (contact instanceof Contact) : "contact is not set: " + contact; //NOI18N
 
                        // Add contact
                        this.addContactToList(contact, list);
                }
 
                // Return finished list
 
                        // Add contact
                        this.addContactToList(contact, list);
                }
 
                // Return finished list
-               this.getLogger().trace(MessageFormat.format("list.size()={0} : EXIT!", list.size()));
+               this.getLogger().trace(MessageFormat.format("list.size()={0} : EXIT!", list.size())); //NOI18N
                return list;
        }
 
                return list;
        }
 
@@ -522,6 +557,9 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
         * @return Read line from file
         */
        private String readLine () {
         * @return Read line from file
         */
        private String readLine () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Init input
                String input = null;
 
                // Init input
                String input = null;
 
@@ -538,6 +576,9 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv
                        this.getLogger().catching(ex);
                }
 
                        this.getLogger().catching(ex);
                }
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N
+
                // Return read string or null
                return input;
        }
                // Return read string or null
                return input;
        }
index 43955eec8f672aaf15085f42eb31faae7a454499..5b6284707f88211d0823681c9464c1103392a25d 100644 (file)
@@ -60,7 +60,13 @@ public class BaseDatabaseFrontend extends BaseFrameworkSystem {
         * Initialize backend
         */
        protected void initBackend () {
         * Initialize backend
         */
        protected void initBackend () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Instance backend
                this.backend = new Base64CsvDatabaseBackend(this.getTableName());
                // Instance backend
                this.backend = new Base64CsvDatabaseBackend(this.getTableName());
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
        }
 }
index cfd7ec1a7caa959419e3907187a8af6a20375e67..30535fd231b3490861fa08166f22f9f5572eddd2 100644 (file)
 package org.mxchange.addressbook.database.frontend.contact;
 
 import java.io.IOException;
 package org.mxchange.addressbook.database.frontend.contact;
 
 import java.io.IOException;
+import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Iterator;
 import java.util.List;
-import org.mxchange.addressbook.exceptions.BadTokenException;
 import org.mxchange.addressbook.contact.Contact;
 import org.mxchange.addressbook.database.backend.csv.CsvBackend;
 import org.mxchange.addressbook.database.frontend.BaseDatabaseFrontend;
 import org.mxchange.addressbook.database.storage.Storeable;
 import org.mxchange.addressbook.contact.Contact;
 import org.mxchange.addressbook.database.backend.csv.CsvBackend;
 import org.mxchange.addressbook.database.frontend.BaseDatabaseFrontend;
 import org.mxchange.addressbook.database.storage.Storeable;
+import org.mxchange.addressbook.exceptions.BadTokenException;
 import org.mxchange.addressbook.manager.contact.ContactManager;
 
 /**
 import org.mxchange.addressbook.manager.contact.ContactManager;
 
 /**
@@ -42,6 +43,15 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
                // Call own constructor
                this();
 
                // Call own constructor
                this();
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("manager={0} - CALLED!", manager)); //NOI18N
+
+               // Manager instance must not be null
+               if (manager == null) {
+                       // Abort here
+                       throw new NullPointerException("manager is null"); //NOI18N
+               }
+
                // Set contact manager
                this.setContactManager(manager);
        }
                // Set contact manager
                this.setContactManager(manager);
        }
@@ -52,8 +62,11 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
        protected ContactDatabaseFrontend () {
                super();
 
        protected ContactDatabaseFrontend () {
                super();
 
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Set "table" name
                // Set "table" name
-               this.setTableName("contacts");
+               this.setTableName("contacts"); //NOI18N
 
                // Initalize backend
                this.initBackend();
 
                // Initalize backend
                this.initBackend();
@@ -64,8 +77,14 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
         */
        @Override
        public void doShutdown () {
         */
        @Override
        public void doShutdown () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Shutdown backend
                this.getBackend().doShutdown();
                // Shutdown backend
                this.getBackend().doShutdown();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -73,6 +92,9 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
         */
        @Override
        public void flushAllContacts () {
         */
        @Override
        public void flushAllContacts () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Get full list
                List<Contact> contacts = this.getContactManager().getList();
 
                // Get full list
                List<Contact> contacts = this.getContactManager().getList();
 
@@ -96,6 +118,9 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
                                System.exit(1);
                        }
                }
                                System.exit(1);
                        }
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -104,6 +129,9 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
         */
        @Override
        public void readAllContacts () {
         */
        @Override
        public void readAllContacts () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Get iterator and case it
                CsvBackend backend = (CsvBackend) this.getBackend();
 
                // Get iterator and case it
                CsvBackend backend = (CsvBackend) this.getBackend();
 
@@ -127,5 +155,8 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
                        // Add contact instance to manager
                        this.getContactManager().addContact(contact);
                }
                        // Add contact instance to manager
                        this.getContactManager().addContact(contact);
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
        }
 }
index 16ec145ecfb4f6ff52647ff0b831c6a183c48153..f27cfb3e874c3325c3ec7b72ee11a257666be4be 100644 (file)
@@ -32,6 +32,12 @@ public class ApplicationManager extends BaseManager implements ManageableApplica
         * @return
         */
        public static final ManageableApplication getManager (final Application application) {
         * @return
         */
        public static final ManageableApplication getManager (final Application application) {
+               // Application instance must be set
+               if (application == null) {
+                       // Abort here
+                       throw new NullPointerException("application is null"); //NOI18N
+               }
+
                // Get manager
                ManageableApplication manager = new ApplicationManager(application);
 
                // Get manager
                ManageableApplication manager = new ApplicationManager(application);
 
@@ -47,16 +53,31 @@ public class ApplicationManager extends BaseManager implements ManageableApplica
        private ApplicationManager (final Application application) {
                super();
 
        private ApplicationManager (final Application application) {
                super();
 
+               // Application instance must be set
+               if (application == null) {
+                       // Abort here
+                       throw new NullPointerException("application is null"); //NOI18N
+               }
+
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Set application instance
                this.setApplication(application);
        }
 
        @Override
        public void start () {
                // Set application instance
                this.setApplication(application);
        }
 
        @Override
        public void start () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Bootstrap application
                this.getApplication().doBootstrap();
 
                // Run the main loop
                this.getApplication().doMainLoop();
                // Bootstrap application
                this.getApplication().doBootstrap();
 
                // Run the main loop
                this.getApplication().doMainLoop();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
        }
 }
index f502e1e3daef2001ddb543f90fdf2eea557392af..128aeebbd5c0d26f9eb39576d1e0b8b450519d1b 100644 (file)
@@ -64,6 +64,18 @@ public class ContactManager extends BaseManager implements ManageableContact {
                // Always call super constructor first
                super();
 
                // Always call super constructor first
                super();
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("maxContacts={0},client={1} - CALLED!", maxContacts, client)); //NOI18N
+
+               // Make sure all parameters are set correctly
+               if (maxContacts <= 0) {
+                       // Must not be zero or smaller
+                       throw new IllegalArgumentException(MessageFormat.format("maxContacts is below or zero: {0}", maxContacts)); //NOI18N
+               } else if (client == null) {
+                       // Abort here
+                       throw new NullPointerException("client is null"); //NOI18N
+               }
+
                // Set client instance
                this.setClient(client);
 
                // Set client instance
                this.setClient(client);
 
@@ -93,9 +105,22 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public void addContact (final Contact contact) {
         */
        @Override
        public void addContact (final Contact contact) {
-               assert (this.contacts instanceof List) : "this.contacts is not initialized";
+               assert (this.contacts instanceof List) : "this.contacts is not initialized"; //NOI18N
+
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
+
+               // Contact instance must not be null
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null"); //NOI18N
+               }
 
 
+               // Add it
                this.contacts.add(contact);
                this.contacts.add(contact);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -103,19 +128,27 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public void doAddOtherAddress () {
         */
        @Override
        public void doAddOtherAddress () {
-               throw new UnsupportedOperationException("Not supported yet.");
+               throw new UnsupportedOperationException("Not supported yet."); //NOI18N
        }
 
        /**
         * Let the user change address data
         *
         * @param contact Instance to change data
        }
 
        /**
         * Let the user change address data
         *
         * @param contact Instance to change data
-        * @param client Client instance to call back
         */
        @Override
         */
        @Override
-       public void doChangeAddressData (final Contact contact, final Client client) {
+       public void doChangeAddressData (final Contact contact) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
+
+               // Contact must not be null
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null"); //NOI18N
+               }
+
                // First display it again
                // First display it again
-               client.displayAddressBox(contact);
+               this.getClient().displayAddressBox(contact);
 
                // Is it own data?
                if (contact.isOwnContact()) {
 
                // Is it own data?
                if (contact.isOwnContact()) {
@@ -123,23 +156,34 @@ public class ContactManager extends BaseManager implements ManageableContact {
                        this.getClient().doChangeOwnAddressData(contact);
                } else {
                        // Other contact's address data to change
                        this.getClient().doChangeOwnAddressData(contact);
                } else {
                        // Other contact's address data to change
-                       throw new UnsupportedOperationException("Changing contact entries not finished.");
+                       throw new UnsupportedOperationException("Changing contact entries not finished."); //NOI18N
                }
 
                // Flush whole list
                this.flush();
                }
 
                // Flush whole list
                this.flush();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
         * Let the user change "name data"
         *
         * @param contact Instance to change data
        }
 
        /**
         * Let the user change "name data"
         *
         * @param contact Instance to change data
-        * @param client Client instance to call back
         */
        @Override
         */
        @Override
-       public void doChangeNameData (final Contact contact, final Client client) {
+       public void doChangeNameData (final Contact contact) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
+
+               // Contact must not be null
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null"); //NOI18N
+               }
+
                // First display them again
                // First display them again
-               client.displayNameBox(contact);
+               this.getClient().displayNameBox(contact);
 
                // Is this own data?
                if (contact.isOwnContact()) {
 
                // Is this own data?
                if (contact.isOwnContact()) {
@@ -147,11 +191,13 @@ public class ContactManager extends BaseManager implements ManageableContact {
                        this.getClient().doChangeOwnNameData(contact);
                } else {
                        // Then re-ask them ...
                        this.getClient().doChangeOwnNameData(contact);
                } else {
                        // Then re-ask them ...
-                       throw new UnsupportedOperationException("Changing contact entries not finished.");
+                       throw new UnsupportedOperationException("Changing contact entries not finished."); //NOI18N
                }
 
                // Flush whole list
                this.flush();
                }
 
                // Flush whole list
                this.flush();
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -159,18 +205,26 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public void doChangeOtherAddress () {
         */
        @Override
        public void doChangeOtherAddress () {
-               throw new UnsupportedOperationException("Not supported yet.");
+               throw new UnsupportedOperationException("Not supported yet."); //NOI18N
        }
 
        /**
         * Let the user change other data
         *
         * @param contact Instance to change data
        }
 
        /**
         * Let the user change other data
         *
         * @param contact Instance to change data
-        * @param client Client instance to call back
         * @todo Didn't handle birthday
         */
        @Override
         * @todo Didn't handle birthday
         */
        @Override
-       public void doChangeOtherData (final Contact contact, final Client client) {
+       public void doChangeOtherData (final Contact contact) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
+
+               // Contact must not be null
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null"); //NOI18N
+               }
+
                // First display them again
                this.getClient().displayOtherDataBox(contact);
 
                // First display them again
                this.getClient().displayOtherDataBox(contact);
 
@@ -180,11 +234,14 @@ public class ContactManager extends BaseManager implements ManageableContact {
                        this.getClient().doChangeOwnOtherData(contact);
                } else {
                        // Then re-ask them ...
                        this.getClient().doChangeOwnOtherData(contact);
                } else {
                        // Then re-ask them ...
-                       throw new UnsupportedOperationException("Changing contact entries not finished.");
+                       throw new UnsupportedOperationException("Changing contact entries not finished."); //NOI18N
                }
 
                // Flush whole list
                this.flush();
                }
 
                // Flush whole list
                this.flush();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -192,13 +249,16 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public void doChangeOwnData () {
         */
        @Override
        public void doChangeOwnData () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                /*
                 * First check if the user has registered own contact, before that
                 * nothing can be changed.
                 */
                if (!this.isOwnContactAdded()) {
                        // Not added
                /*
                 * First check if the user has registered own contact, before that
                 * nothing can be changed.
                 */
                if (!this.isOwnContactAdded()) {
                        // Not added
-                       this.getClient().outputMessage("Sie haben noch nicht Ihre Daten eingegeben.");
+                       this.getClient().outputMessage("Sie haben noch nicht Ihre Daten eingegeben."); //NOI18N
 
                        // Skip any below code
                        return;
 
                        // Skip any below code
                        return;
@@ -219,6 +279,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
                } catch (final UnhandledUserChoiceException ex) {
                        this.getLogger().catching(ex);
                }
                } catch (final UnhandledUserChoiceException ex) {
                        this.getLogger().catching(ex);
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -226,7 +289,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public void doDeleteOtherAddress () {
         */
        @Override
        public void doDeleteOtherAddress () {
-               throw new UnsupportedOperationException("Not supported yet.");
+               throw new UnsupportedOperationException("Not supported yet."); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -234,6 +297,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public void doEnterOwnData () {
         */
        @Override
        public void doEnterOwnData () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Deligate this call to the client
                Contact contact = this.getClient().doEnterOwnData();
 
                // Deligate this call to the client
                Contact contact = this.getClient().doEnterOwnData();
 
@@ -242,16 +308,19 @@ public class ContactManager extends BaseManager implements ManageableContact {
                        // Add it to contact "book"
                        this.registerContact(contact);
                }
                        // Add it to contact "book"
                        this.registerContact(contact);
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        @Override
        public void doListContacts () {
        }
 
        @Override
        public void doListContacts () {
-               throw new UnsupportedOperationException("Not supported yet.");
+               throw new UnsupportedOperationException("Not supported yet."); //NOI18N
        }
 
        @Override
        public void doSearchContacts () {
        }
 
        @Override
        public void doSearchContacts () {
-               throw new UnsupportedOperationException("Not supported yet.");
+               throw new UnsupportedOperationException("Not supported yet."); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -259,8 +328,14 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public void doShutdown () {
         */
        @Override
        public void doShutdown () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Shut down the database layer
                this.getContactDatabase().doShutdown();
                // Shut down the database layer
                this.getContactDatabase().doShutdown();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -270,6 +345,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnCellNumber () {
         */
        @Override
        public String enterOwnCellNumber () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(5, 30, "Bitte geben Sie Ihre Handynummer an: ", true);
        }
 
                return this.getClient().enterString(5, 30, "Bitte geben Sie Ihre Handynummer an: ", true);
        }
 
@@ -280,6 +358,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnCity () {
         */
        @Override
        public String enterOwnCity () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(3, 50, "Bitte geben Sie Ihre Wohnort ein: ", false);
        }
 
                return this.getClient().enterString(3, 50, "Bitte geben Sie Ihre Wohnort ein: ", false);
        }
 
@@ -290,6 +371,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnComment () {
         */
        @Override
        public String enterOwnComment () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(0, 100, "Kommentar zu Ihrem Eintrag: ", true);
        }
 
                return this.getClient().enterString(0, 100, "Kommentar zu Ihrem Eintrag: ", true);
        }
 
@@ -300,6 +384,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnCompanyName () {
         */
        @Override
        public String enterOwnCompanyName () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(5, 50, "Bitte geben Sie Ihre Firmenbezeichnung ein: ", true);
        }
 
                return this.getClient().enterString(5, 50, "Bitte geben Sie Ihre Firmenbezeichnung ein: ", true);
        }
 
@@ -310,6 +397,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnCountryCode () {
         */
        @Override
        public String enterOwnCountryCode () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(2, 2, "Bitte geben Sie den zweistelligen Ländercode von Ihrem Land ein: ", false).toUpperCase();
        }
 
                return this.getClient().enterString(2, 2, "Bitte geben Sie den zweistelligen Ländercode von Ihrem Land ein: ", false).toUpperCase();
        }
 
@@ -320,6 +410,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnEmailAddress () {
         */
        @Override
        public String enterOwnEmailAddress () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(10, 50, "Bitte geben Sie Ihre Email-Adresse ein: ", true);
        }
 
                return this.getClient().enterString(10, 50, "Bitte geben Sie Ihre Email-Adresse ein: ", true);
        }
 
@@ -330,6 +423,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnFamilyName () {
         */
        @Override
        public String enterOwnFamilyName () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(2, 50, "Bitte geben Sie Ihren Nachnamen ein: ", false);
        }
 
                return this.getClient().enterString(2, 50, "Bitte geben Sie Ihren Nachnamen ein: ", false);
        }
 
@@ -340,6 +436,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnFaxNumber () {
         */
        @Override
        public String enterOwnFaxNumber () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(5, 30, "Bitte geben Sie Ihre Faxnummer an: ", true);
        }
 
                return this.getClient().enterString(5, 30, "Bitte geben Sie Ihre Faxnummer an: ", true);
        }
 
@@ -350,6 +449,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public Gender enterOwnGender () {
         */
        @Override
        public Gender enterOwnGender () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterGender("Bitte geben Sie die Anrede ein: (M=Herr, F=Frau, C=Firma): ");
        }
 
                return this.getClient().enterGender("Bitte geben Sie die Anrede ein: (M=Herr, F=Frau, C=Firma): ");
        }
 
@@ -360,6 +462,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnPhoneNumber () {
         */
        @Override
        public String enterOwnPhoneNumber () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(5, 30, "Bitte geben Sie Ihre Telefonnummer an: ", true);
        }
 
                return this.getClient().enterString(5, 30, "Bitte geben Sie Ihre Telefonnummer an: ", true);
        }
 
@@ -370,6 +475,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnStreet () {
         */
        @Override
        public String enterOwnStreet () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(5, 50, "Bitte geben Sie Ihre Strasse und Hausnummer ein: ", false);
        }
 
                return this.getClient().enterString(5, 50, "Bitte geben Sie Ihre Strasse und Hausnummer ein: ", false);
        }
 
@@ -380,6 +488,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String enterOwnSurname () {
         */
        @Override
        public String enterOwnSurname () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterString(2, 50, "Bitte geben Sie Ihren Vornamen ein: ", false);
        }
 
                return this.getClient().enterString(2, 50, "Bitte geben Sie Ihren Vornamen ein: ", false);
        }
 
@@ -390,12 +501,15 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public int enterOwnZipCode () {
         */
        @Override
        public int enterOwnZipCode () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                return this.getClient().enterInt(0, 99_999, "Bitte geben Sie Ihre Postleitzahl ein: ");
        }
 
        @Override
        public final int getColumnCount () {
                return this.getClient().enterInt(0, 99_999, "Bitte geben Sie Ihre Postleitzahl ein: ");
        }
 
        @Override
        public final int getColumnCount () {
-               assert (this.columnNames instanceof List) : "this.columnNames is not initialized";
+               assert (this.columnNames instanceof List) : "this.columnNames is not initialized"; //NOI18N
 
                return this.columnNames.size();
        }
 
                return this.columnNames.size();
        }
@@ -408,7 +522,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public String getColumnName (final int columnIndex) {
         */
        @Override
        public String getColumnName (final int columnIndex) {
-               assert (this.columnNames instanceof List) : "this.columnNames is not initialized";
+               assert (this.columnNames instanceof List) : "this.columnNames is not initialized"; //NOI18N
 
                // Get column name at index
                return this.columnNames.get(columnIndex);
 
                // Get column name at index
                return this.columnNames.get(columnIndex);
@@ -421,7 +535,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public List<Contact> getList () {
         */
        @Override
        public List<Contact> getList () {
-               assert (this.contacts instanceof List) : "this.contacts is not initialized";
+               assert (this.contacts instanceof List) : "this.contacts is not initialized"; //NOI18N
                return Collections.unmodifiableList(this.contacts);
        }
 
                return Collections.unmodifiableList(this.contacts);
        }
 
@@ -434,9 +548,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
        @Override
        public boolean isOwnContactAdded () {
                // Trace message
        @Override
        public boolean isOwnContactAdded () {
                // Trace message
-               this.getLogger().trace("CALLED!");
+               this.getLogger().trace("CALLED!"); //NOI18N
 
 
-               assert (this.contacts instanceof List) : "this.contacts is not initialized";
+               assert (this.contacts instanceof List) : "this.contacts is not initialized"; //NOI18N
 
                // Default is not added
                boolean isAdded = false;
 
                // Default is not added
                boolean isAdded = false;
@@ -463,7 +577,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
                }
 
                // Trace message
                }
 
                // Trace message
-               this.getLogger().trace(MessageFormat.format("isAdded={0} : EXIT!", isAdded));
+               this.getLogger().trace(MessageFormat.format("isAdded={0} : EXIT!", isAdded)); //NOI18N
 
                // Return result
                return isAdded;
 
                // Return result
                return isAdded;
@@ -477,10 +591,19 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public void registerContact (final Contact contact) {
         */
        @Override
        public void registerContact (final Contact contact) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
+
+               // Contact must not be null
+               if (contact == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null"); //NOI18N
+               }
+
                // Sanity check
                if (contact == null) {
                        // Abort here
                // Sanity check
                if (contact == null) {
                        // Abort here
-                       throw new NullPointerException("contact is null");
+                       throw new NullPointerException("contact is null"); //NOI18N
                }
 
                // Check if contact is found
                }
 
                // Check if contact is found
@@ -493,7 +616,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
                }
 
                // Debug message
                }
 
                // Debug message
-               /* NOISY-DEBUG: */ this.getLogger().debug(MessageFormat.format("Adding '{0}' '{1}' at pos '{2}' ...", contact.getSurname(), contact.getFamilyName(), this.size()));
+               /* NOISY-DEBUG: */ this.getLogger().debug(MessageFormat.format("Adding '{0}' '{1}' at pos '{2}' ...", contact.getSurname(), contact.getFamilyName(), this.size())); //NOI18N
 
                // Add contact to internal list
                this.addContact(contact);
 
                // Add contact to internal list
                this.addContact(contact);
@@ -509,7 +632,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
         */
        @Override
        public final int size () {
         */
        @Override
        public final int size () {
-               assert (this.contacts instanceof List) : "this.contacts is not initialized";
+               assert (this.contacts instanceof List) : "this.contacts is not initialized"; //NOI18N
                return this.contacts.size();
        }
 
                return this.contacts.size();
        }
 
@@ -517,10 +640,10 @@ public class ContactManager extends BaseManager implements ManageableContact {
         * Fills the column names array with strings from bundle
         */
        private void fillColumnNamesFromBundle () {
         * Fills the column names array with strings from bundle
         */
        private void fillColumnNamesFromBundle () {
-               assert (this.columnNames instanceof List) : "this.columnNames is not initialized";
+               assert (this.columnNames instanceof List) : "this.columnNames is not initialized"; //NOI18N
 
                // Debug message
 
                // Debug message
-               this.getLogger().trace("CALLED!");
+               this.getLogger().trace("CALLED!"); //NOI18N
 
                // First get an iterator from key set to iterate over
                Iterator<String> iterator = this.getBundle().keySet().iterator();
 
                // First get an iterator from key set to iterate over
                Iterator<String> iterator = this.getBundle().keySet().iterator();
@@ -531,9 +654,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
                        String key = iterator.next();
 
                        // Does the key start with ContactManager.columnName ?
                        String key = iterator.next();
 
                        // Does the key start with ContactManager.columnName ?
-                       if (key.startsWith("ContactManager.columnName")) {
+                       if (key.startsWith("ContactManager.columnName")) { //NOI18N
                                // This is the wanted entry.
                                // This is the wanted entry.
-                               this.getLogger().debug(MessageFormat.format("key={0}", key));
+                               this.getLogger().debug(MessageFormat.format("key={0}", key)); //NOI18N
 
                                // So add it
                                this.columnNames.add(this.getBundle().getString(key));
 
                                // So add it
                                this.columnNames.add(this.getBundle().getString(key));
@@ -541,15 +664,21 @@ public class ContactManager extends BaseManager implements ManageableContact {
                }
 
                // Debug message
                }
 
                // Debug message
-               this.getLogger().trace(MessageFormat.format("getColumnCount()={0}: EXIT!", this.getColumnCount()));
+               this.getLogger().trace(MessageFormat.format("getColumnCount()={0}: EXIT!", this.getColumnCount())); //NOI18N
        }
 
        /**
         * Flushes all entries by calling database backend
         */
        private void flush () {
        }
 
        /**
         * Flushes all entries by calling database backend
         */
        private void flush () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Flusgh all
                this.getContactDatabase().flushAllContacts();
                // Flusgh all
                this.getContactDatabase().flushAllContacts();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -567,7 +696,10 @@ public class ContactManager extends BaseManager implements ManageableContact {
         * @return Contact instance or null
         */
        private Contact getOwnContact () {
         * @return Contact instance or null
         */
        private Contact getOwnContact () {
-               assert (this.contacts instanceof List) : "this.contacts is not initialized";
+               assert (this.contacts instanceof List) : "this.contacts is not initialized"; //NOI18N
+
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
 
                // Now get it back from address book, first get an iterator
                Iterator<Contact> iterator = this.contacts.iterator();
 
                // Now get it back from address book, first get an iterator
                Iterator<Contact> iterator = this.contacts.iterator();
@@ -589,6 +721,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
                        }
                }
 
                        }
                }
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("contact={0} - EXIT!", contact)); //NOI18N
+
                // Return instance or null
                return contact;
        }
                // Return instance or null
                return contact;
        }
@@ -600,7 +735,16 @@ public class ContactManager extends BaseManager implements ManageableContact {
         * @return TRUE if found, FALSE if not found
         */
        private boolean isContactAlreadyAdded (final Contact checkContact) throws NullPointerException {
         * @return TRUE if found, FALSE if not found
         */
        private boolean isContactAlreadyAdded (final Contact checkContact) throws NullPointerException {
-               assert (this.contacts instanceof List) : "this.contacts is not initialized";
+               assert (this.contacts instanceof List) : "this.contacts is not initialized"; //NOI18N
+
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("checkContact={0} - CALLED!", checkContact)); //NOI18N
+
+               // Contact instance must not be null
+               if (checkContact == null) {
+                       // Abort here
+                       throw new NullPointerException("checkContact is null");
+               }
 
                // Default is not found
                boolean isFound = false;
 
                // Default is not found
                boolean isFound = false;
@@ -625,6 +769,9 @@ public class ContactManager extends BaseManager implements ManageableContact {
                        }
                }
 
                        }
                }
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("isFound={0} - EXIT!", isFound)); //NOI18N
+
                // Return result
                return isFound;
        }
                // Return result
                return isFound;
        }
index 2ed123c2ee6592afab633406d6802feb896c0f7f..6c4ff93d4ebface32e0e22fbc5b2d636bcc068ab 100644 (file)
@@ -17,7 +17,6 @@
 package org.mxchange.addressbook.manager.contact;
 
 import java.util.List;
 package org.mxchange.addressbook.manager.contact;
 
 import java.util.List;
-import org.mxchange.addressbook.client.Client;
 import org.mxchange.addressbook.contact.Contact;
 import org.mxchange.addressbook.contact.Gender;
 import org.mxchange.addressbook.manager.Manageable;
 import org.mxchange.addressbook.contact.Contact;
 import org.mxchange.addressbook.contact.Gender;
 import org.mxchange.addressbook.manager.Manageable;
@@ -169,18 +168,16 @@ public interface ManageableContact extends Manageable {
         * of given Contact instance.
         *
         * @param contact Instance to change data
         * of given Contact instance.
         *
         * @param contact Instance to change data
-        * @param client Client instance to call back
         */
         */
-       public void doChangeAddressData (final Contact contact, final Client client);
+       public void doChangeAddressData (final Contact contact);
 
        /**
         * The user can change name data, like gender, surname, family name and
         * company name (if business contact).
         *
         * @param contact Instance to change data
 
        /**
         * The user can change name data, like gender, surname, family name and
         * company name (if business contact).
         *
         * @param contact Instance to change data
-        * @param client Client instance to call back
         */
         */
-       public void doChangeNameData (final Contact contact, final Client client);
+       public void doChangeNameData (final Contact contact);
 
        /**
         * Let the user change other address
 
        /**
         * Let the user change other address
@@ -191,9 +188,8 @@ public interface ManageableContact extends Manageable {
         * The user can change other data, like phone numbers or comments.
         *
         * @param contact Instance to change data
         * The user can change other data, like phone numbers or comments.
         *
         * @param contact Instance to change data
-        * @param client Client instance to call back
         */
         */
-       public void doChangeOtherData (final Contact contact, final Client client);
+       public void doChangeOtherData (final Contact contact);
 
        /**
         * Let the user change own data
 
        /**
         * Let the user change own data
index 418a7cb1b784bf39c26c2618d481945ab803242a..af29b11fa065e17dafe51b66d4ce94bce5d05a53 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.menu;
 
  */
 package org.mxchange.addressbook.menu;
 
+import java.text.MessageFormat;
 import java.util.List;
 import org.apache.logging.log4j.Logger;
 import org.mxchange.addressbook.BaseFrameworkSystem;
 import java.util.List;
 import org.apache.logging.log4j.Logger;
 import org.mxchange.addressbook.BaseFrameworkSystem;
@@ -40,15 +41,27 @@ public class AddressbookMenu extends BaseFrameworkSystem {
                // Get logger
                Logger log = new AddressbookMenu().getLogger();
 
                // Get logger
                Logger log = new AddressbookMenu().getLogger();
 
+               // Trace call
+               log.trace(MessageFormat.format("menuList={0},menuType={1},client={2} - CALLED!", menuList, menuType, client)); //NOI18N
+
+               // Some instances must be set
+               if (menuList == null) {
+                       // Abort here
+                       throw new NullPointerException("menuList is null"); //NOI18N
+               } else if (client == null) {
+                       // Abort here
+                       throw new NullPointerException("contact is null"); //NOI18N
+               }
+
                // Get list size
                int size = menuList.size();
 
                // Debug message
                // Get list size
                int size = menuList.size();
 
                // Debug message
-               log.debug("Adding menu for '" + menuType + "' (old size: '" + size + "') ...");
+               log.debug(MessageFormat.format("Adding menu for '{0}' (old size: '{1}') ...", menuType, size)); //NOI18N
 
                // Depends on type
                switch (menuType) {
 
                // Depends on type
                switch (menuType) {
-                       case "main": // Main menu
+                       case "main": // Main menu //NOI18N
                                // Enter own data
                                menuList.add(client.getMenuItem('1', "Eigene Adresse anlegen"));
 
                                // Enter own data
                                menuList.add(client.getMenuItem('1', "Eigene Adresse anlegen"));
 
@@ -75,7 +88,7 @@ public class AddressbookMenu extends BaseFrameworkSystem {
                                break;
 
                        default: // Not supported
                                break;
 
                        default: // Not supported
-                               log.error("Menu type '" + menuType + "' ont supported");
+                               log.error(MessageFormat.format("Menu type '{0}' ont supported", menuType)); //NOI18N
                                System.exit(1);
                }
 
                                System.exit(1);
                }
 
index 73f3422db93b0ea38bc6354659e6fb514e6e3c4b..de12ad4fdc5a4d2e500bee2e2ce2c81eef6493b7 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.menu;
 
  */
 package org.mxchange.addressbook.menu;
 
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -65,6 +66,15 @@ public class BaseMenu extends BaseFrameworkSystem {
         * @param client Client instance to call back
         */
        public void show (final Client client) {
         * @param client Client instance to call back
         */
        public void show (final Client client) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("client={0} CALLED!", client)); //NOI18N
+
+               // Client must not be null
+               if (client == null) {
+                       // Abort here
+                       throw new NullPointerException("client is null"); //NOI18N
+               }
+
                // Get values
                Iterator<SelectableMenuItem> iterator = this.menuList.iterator();
 
                // Get values
                Iterator<SelectableMenuItem> iterator = this.menuList.iterator();
 
@@ -79,6 +89,9 @@ public class BaseMenu extends BaseFrameworkSystem {
                        // Show this item
                        item.show(client);
                }
                        // Show this item
                        item.show(client);
                }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -97,7 +110,13 @@ public class BaseMenu extends BaseFrameworkSystem {
         * @param client CLient to call back
         */
        protected void initMenu (final String menuType, final Client client) {
         * @param client CLient to call back
         */
        protected void initMenu (final String menuType, final Client client) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("menuType={0},client={1} - CALLED!", menuType, client)); //NOI18N
+
                // Init menu list
                this.menuList = new ArrayList<>(5);
                // Init menu list
                this.menuList = new ArrayList<>(5);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
        }
 }
index a8d5bd3cec318c4a4321ca1b03078c2db18c12f8..f1c1f2c863bc290877f73396e0aa2b11fdcb9886 100644 (file)
@@ -62,11 +62,11 @@ public class MenuTools extends BaseFrameworkSystem {
                while (iterator.hasNext()) {
                        // Get item
                        SelectableMenuItem item = iterator.next();
                while (iterator.hasNext()) {
                        // Get item
                        SelectableMenuItem item = iterator.next();
-           //* NOISY-DEBUG: */ logger.debug("item=" + item);
+                       //* NOISY-DEBUG: */ logger.debug("item=" + item);
 
                        // Get access key from item and add it to the array
                        accessKeys[i] = item.getAccessKey();
 
                        // Get access key from item and add it to the array
                        accessKeys[i] = item.getAccessKey();
-           //* NOISY-DEBUG: */ logger.debug("accessKeys[" + i + "]=" + accessKeys[i]);
+                       //* NOISY-DEBUG: */ logger.debug("accessKeys[" + i + "]=" + accessKeys[i]);
 
                        // Increment counter
                        i++;
 
                        // Increment counter
                        i++;
index 7064473b735399be33004353f1cd8bd3b79e5837..6eff64f6cb6377bcad13ec1cd28900899870af34 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.menu.console;
 
  */
 package org.mxchange.addressbook.menu.console;
 
+import java.text.MessageFormat;
 import org.mxchange.addressbook.client.Client;
 import org.mxchange.addressbook.menu.AddressbookMenu;
 import org.mxchange.addressbook.menu.BaseMenu;
 import org.mxchange.addressbook.client.Client;
 import org.mxchange.addressbook.menu.AddressbookMenu;
 import org.mxchange.addressbook.menu.BaseMenu;
@@ -34,6 +35,16 @@ public class ConsoleMenu extends BaseMenu implements Menu {
         * @param client CLient to call back
         */
        public ConsoleMenu (final String menuType, final Client client) {
         * @param client CLient to call back
         */
        public ConsoleMenu (final String menuType, final Client client) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("menuType={0},client={1} - CALLED!", menuType, client)); //NOI18N
+
+               // Client must not be null
+               if (client == null)  {
+                       // Abort here
+                       throw new NullPointerException("client is null");
+               }
+
+               // Init menu
                this.initMenu(menuType, client);
 
                // Add all items
                this.initMenu(menuType, client);
 
                // Add all items
index 7fe38bbe242183e0b079aa2f971c9360a43cb67b..8b863cd0c0ab3e484e6091e1863ecf83eed5b5b4 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.menu.item.console;
 
  */
 package org.mxchange.addressbook.menu.item.console;
 
+import java.text.MessageFormat;
 import org.mxchange.addressbook.client.Client;
 import org.mxchange.addressbook.menu.item.BaseMenuItem;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.addressbook.client.Client;
 import org.mxchange.addressbook.menu.item.BaseMenuItem;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
@@ -43,8 +44,8 @@ public class ConsoleMenuItem extends BaseMenuItem implements SelectableMenuItem
         * @param text Text to show to user
         */
        public ConsoleMenuItem (final char accessKey, final String text) {
         * @param text Text to show to user
         */
        public ConsoleMenuItem (final char accessKey, final String text) {
-               this.accessKey = accessKey;
-               this.text = text;
+               this.setAccessKey(accessKey);
+               this.setText(text);
        }
 
        /**
        }
 
        /**
@@ -69,8 +70,20 @@ public class ConsoleMenuItem extends BaseMenuItem implements SelectableMenuItem
 
        @Override
        public void show (final Client client) {
 
        @Override
        public void show (final Client client) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("client={0} - CALLED!", client)); //NOI18N
+
+               // Client must not be null
+               if (client == null) {
+                       // Abort here
+                       throw new NullPointerException("client is null");
+               }
+
                // Call-back client over menu
                client.showEntry(this);
                // Call-back client over menu
                client.showEntry(this);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
index e1991653254cbfa55a40ec21cb5171f286efcbea..c55261c4281993acc0a0d1d6f690531601ad4624 100644 (file)
@@ -37,6 +37,9 @@ public class BaseModel extends BaseFrameworkSystem {
         * Protected constructor
         */
        protected BaseModel () {
         * Protected constructor
         */
        protected BaseModel () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Init listener list
                this.eventListenerList = new EventListenerList();
        }
                // Init listener list
                this.eventListenerList = new EventListenerList();
        }
@@ -47,11 +50,23 @@ public class BaseModel extends BaseFrameworkSystem {
         * @param listener Listener instance
         */
        public void addListDataListener (final ListDataListener listener) {
         * @param listener Listener instance
         */
        public void addListDataListener (final ListDataListener listener) {
+               // Trace message
+               this.getLogger().trace("listener=" + listener + " - CALLED!"); //NOI18N
+
+               // Listener must not be null
+               if (listener == null) {
+                       // Abort here
+                       throw new NullPointerException("listener is null");
+               }
+
                // Debug message
                this.getLogger().debug(MessageFormat.format("Adding listener {0} ...", listener.getClass()));
 
                // Remove listener
                this.eventListenerList.add(ListDataListener.class, listener);
                // Debug message
                this.getLogger().debug(MessageFormat.format("Adding listener {0} ...", listener.getClass()));
 
                // Remove listener
                this.eventListenerList.add(ListDataListener.class, listener);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -60,11 +75,23 @@ public class BaseModel extends BaseFrameworkSystem {
         * @param listener Lister instance
         */
        public void addTableModelListener (final TableModelListener listener) {
         * @param listener Lister instance
         */
        public void addTableModelListener (final TableModelListener listener) {
+               // Trace message
+               this.getLogger().trace("listener=" + listener + " - CALLED!"); //NOI18N
+
+               // Listener must not be null
+               if (listener == null) {
+                       // Abort here
+                       throw new NullPointerException("listener is null");
+               }
+
                // Debug message
                this.getLogger().debug(MessageFormat.format("Adding listener {0} ...", listener.getClass()));
 
                // Add listener
                this.eventListenerList.add(TableModelListener.class, listener);
                // Debug message
                this.getLogger().debug(MessageFormat.format("Adding listener {0} ...", listener.getClass()));
 
                // Add listener
                this.eventListenerList.add(TableModelListener.class, listener);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -73,11 +100,23 @@ public class BaseModel extends BaseFrameworkSystem {
         * @param listener Listener instance
         */
        public void removeListDataListener (final ListDataListener listener) {
         * @param listener Listener instance
         */
        public void removeListDataListener (final ListDataListener listener) {
+               // Trace message
+               this.getLogger().trace("listener=" + listener + " - CALLED!"); //NOI18N
+
+               // Listener must not be null
+               if (listener == null) {
+                       // Abort here
+                       throw new NullPointerException("listener is null");
+               }
+
                // Debug message
                this.getLogger().debug(MessageFormat.format("Removing listener {0} ...", listener.getClass()));
 
                // Remove listener
                this.eventListenerList.remove(ListDataListener.class, listener);
                // Debug message
                this.getLogger().debug(MessageFormat.format("Removing listener {0} ...", listener.getClass()));
 
                // Remove listener
                this.eventListenerList.remove(ListDataListener.class, listener);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**
        }
 
        /**
@@ -86,10 +125,22 @@ public class BaseModel extends BaseFrameworkSystem {
         * @param listener Listener instance
         */
        public void removeTableModelListener (final TableModelListener listener) {
         * @param listener Listener instance
         */
        public void removeTableModelListener (final TableModelListener listener) {
+               // Trace message
+               this.getLogger().trace("listener=" + listener + " - CALLED!"); //NOI18N
+
+               // Listener must not be null
+               if (listener == null) {
+                       // Abort here
+                       throw new NullPointerException("listener is null");
+               }
+
                // Debug message
                this.getLogger().debug(MessageFormat.format("Removing listener {0} ...", listener.getClass()));
 
                // Remove listener
                this.eventListenerList.remove(TableModelListener.class, listener);
                // Debug message
                this.getLogger().debug(MessageFormat.format("Removing listener {0} ...", listener.getClass()));
 
                // Remove listener
                this.eventListenerList.remove(TableModelListener.class, listener);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 }
        }
 }
index ef125a037c52dc8c4641781baadaf2e42d1147b8..30307c69ef4142d68893ff5cf9135a8df978d863 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.addressbook.model.contact;
 
  */
 package org.mxchange.addressbook.model.contact;
 
+import java.text.MessageFormat;
 import javax.swing.table.TableModel;
 import org.mxchange.addressbook.client.Client;
 import org.mxchange.addressbook.model.BaseModel;
 import javax.swing.table.TableModel;
 import org.mxchange.addressbook.client.Client;
 import org.mxchange.addressbook.model.BaseModel;
@@ -36,6 +37,15 @@ public class ContactTableModel extends BaseModel implements TableModel {
                // Parent super constructor
                super();
 
                // Parent super constructor
                super();
 
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("client={1} - CALLED!", client)); //NOI18N
+
+               // Client must not be null
+               if (client == null)  {
+                       // Abort here
+                       throw new NullPointerException("client is null"); //NOI18N
+               }
+
                // Set client
                this.setClient(client);
        }
                // Set client
                this.setClient(client);
        }