]> git.mxchange.org Git - pizzaservice-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 17:35:24 +0000 (19:35 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java

index 64de36de69c9fa8e9f44e7863364d9e021a252ac..e82dd71603ac1fa469e555423129650ec7c438c7 100644 (file)
@@ -601,6 +601,14 @@ public class PizzaAdminUserWebSessionBean implements PizzaAdminUserWebSessionCon
 
        @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;