]> git.mxchange.org Git - addressbook-lib.git/blobdiff - src/org/mxchange/addressbook/menu/MenuTools.java
Continued:
[addressbook-lib.git] / src / org / mxchange / addressbook / menu / MenuTools.java
index 54d7c968e9d113b48694cba0d2fb95ca94307825..9f424755423583db5a98ef321dcb5fd77d6eaaf0 100644 (file)
  */
 package org.mxchange.addressbook.menu;
 
-import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.Map;
 import org.mxchange.addressbook.BaseAddressbookSystem;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
+import org.mxchange.jcore.exceptions.MenuInitializationException;
 
 /**
  * Menu utilities
@@ -36,17 +36,16 @@ public class MenuTools extends BaseAddressbookSystem {
         * @param menus A Map with all menus and their entries
         * @param menuType Menu type
         * @return An array with available access chars
+        * @throws org.mxchange.jcore.exceptions.MenuInitializationException If the menu cannot be initialized
         */
-       public static char[] getAccessKeysFromMenuMap (final Map<String, Menu> menus, final String menuType) {
+       public static char[] getAccessKeysFromMenuMap (final Map<String, Menu> menus, final String menuType) throws MenuInitializationException {
                // First search for the proper menu class
                Menu menu = menus.get(menuType);
 
                // Is it there?
                if (!(menu instanceof Menu)) {
                        // Not found
-                       // TODO Rewrite to exception
-                       System.err.println(MessageFormat.format("menu is not implementing Menu: {0}", menu)); //NOI18N
-                       System.exit(1);
+                       throw new MenuInitializationException(menu, menuType);
                }
 
                // Get iterator