]> git.mxchange.org Git - jjobs-war.git/commitdiff
Added check for parameter, to make sure only valid can pass
authorRoland Häder <roland@mxchange.org>
Tue, 19 Apr 2016 12:26:24 +0000 (14:26 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 19 Apr 2016 18:20:25 +0000 (20:20 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java

index 3714d194314db290eced9fdb6925dec406d32caa..2060923a7d617b22a0a83bbced05728469866acd 100644 (file)
@@ -601,6 +601,14 @@ public class JobsAdminUserWebSessionBean implements JobsAdminUserWebSessionContr
 
        @Override
        public User lookupUserById (final Long userId) throws UserNotFoundException {
+               if (null == userId) {
+                       // Throw NPE
+                       throw new NullPointerException("userId is null"); //NOI18N
+               } else if (userId < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("userId={0} is not valid.", userId)); //NOI18N
+               }
+
                // Init variable
                User user = null;