From: Roland Häder Date: Sun, 5 Nov 2017 14:02:37 +0000 (+0100) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5b4e3976c3332325b105b33c06d0c5ab8e635b35;p=jcore-utils.git Continued a bit: - now there are 3 message bundles: generic, project and local - added public, static method removeBundles() - fixed exception message, the i18nKey was empty, not NULL Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java b/src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java index 15194e3..f9ab2b4 100644 --- a/src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java +++ b/src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java @@ -49,7 +49,17 @@ public abstract class BaseFacesBean extends BaseBean { */ static { // Init resource bundle list - RESOURCE_BUNDLES = new ArrayList<>(2); + RESOURCE_BUNDLES = new ArrayList<>(3); + } + + /** + * Removes all bundles from web application. Typically you want to invoke + * this method in a ServletContextListener implemetation on the + * contextDestroyed() method. + */ + public static void removeBundles () { + // Clear bundles + RESOURCE_BUNDLES.clear(); } /** @@ -99,9 +109,6 @@ public abstract class BaseFacesBean extends BaseBean { * @param parameterKey Property key *

* @return Property value - *

- * @throws NullPointerException If given key is not found - * @throws NumberFormatException If no number is given in context parameter */ protected int getIntegerContextParameter (final String parameterKey) throws NullPointerException, NumberFormatException { // Get context parameter @@ -118,6 +125,9 @@ public abstract class BaseFacesBean extends BaseBean { * @param i18nKey I18n key *

* @return Localized message + *

+ * @throws NullPointerException If the parameter is null + * @throws IllegalArgumentException If the parameter is empty */ protected String getMessageFromBundle (final String i18nKey) { // Validate parameter @@ -126,7 +136,7 @@ public abstract class BaseFacesBean extends BaseBean { throw new NullPointerException("i18nKey is null"); //NOI18N } else if (i18nKey.isEmpty()) { // Is empty - throw new IllegalArgumentException("i18nKey is null"); //NOI18N + throw new IllegalArgumentException("i18nKey is empty"); //NOI18N } // Get current locale