]> git.mxchange.org Git - jcoreee.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 19 Oct 2022 12:10:41 +0000 (14:10 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 19 Oct 2022 12:10:41 +0000 (14:10 +0200)
- added more checks on method/constructor parameter
- made more local variables final

src/org/mxchange/jcoreee/bean/ejb/BaseEnterpriseBean.java
src/org/mxchange/jcoreee/bean/faces/BaseFacesBean.java

index f57faf055544b9951c9989ed13361b303ec0270a..e0d6755864241c23f534942865fabe0c6281f685 100644 (file)
@@ -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
index f8c066ccb2905ecce43d2d35be80518b38331e10..be104a1f60cb77b72d082235436936d5793bb8d8 100644 (file)
@@ -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));