From: Roland Häder Date: Wed, 19 Oct 2022 12:10:41 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4df1b42874bff0e778e89bb9a63c45b527f9a743;p=jcoreee.git Continued: - added more checks on method/constructor parameter - made more local variables final --- diff --git a/src/org/mxchange/jcoreee/bean/ejb/BaseEnterpriseBean.java b/src/org/mxchange/jcoreee/bean/ejb/BaseEnterpriseBean.java index f57faf0..e0d6755 100644 --- a/src/org/mxchange/jcoreee/bean/ejb/BaseEnterpriseBean.java +++ b/src/org/mxchange/jcoreee/bean/ejb/BaseEnterpriseBean.java @@ -98,6 +98,21 @@ public abstract class BaseEnterpriseBean implements Serializable { // Invoke default constructor this(); + // Validate all parameter + if (null == factoryJndi) { + // Throw IAE + throw new NullPointerException("factoryJndi is null"); //NOI18N + } else if (factoryJndi.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("factoryJndi is empty"); //NOI18N + } else if (null == queueJndi) { + // Throw IAE + throw new NullPointerException("queueJndi is null"); //NOI18N + } else if (queueJndi.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("queueJndi is empty"); //NOI18N + } + // Try it out try { // Get initial context diff --git a/src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java b/src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java index f8c066c..be104a1 100644 --- a/src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java +++ b/src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java @@ -145,6 +145,15 @@ public abstract class BaseFacesBean implements Serializable { * @return Property value */ protected int getIntegerContextParameter (final String parameterKey) throws NullPointerException, NumberFormatException { + // Validate parameter + if (null == parameterKey) { + // Throw IAE + throw new NullPointerException("parameterKey is null"); //NOI18N + } else if (parameterKey.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("parameterKey is empty"); //NOI18N + } + // Get context parameter final Integer contextValue = Integer.parseInt(this.getStringContextParameter(parameterKey));