]> git.mxchange.org Git - jfinancials-swing.git/blobdiff - Addressbook/src/org/mxchange/addressbook/menu/item/console/ConsoleMenuItem.java
Added a lot trace messages + sanity checks for null references and such things
[jfinancials-swing.git] / Addressbook / src / org / mxchange / addressbook / menu / item / console / ConsoleMenuItem.java
index 7fe38bbe242183e0b079aa2f971c9360a43cb67b..8b863cd0c0ab3e484e6091e1863ecf83eed5b5b4 100644 (file)
@@ -16,6 +16,7 @@
  */
 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;
@@ -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) {
-               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) {
+               // 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);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        /**