From: Roland Häder Date: Tue, 19 Apr 2016 12:26:24 +0000 (+0200) Subject: Added check for parameter, to make sure only valid can pass X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;ds=sidebyside;h=a401c071203217a763c27e94c1642c6096341611;p=pizzaservice-war.git Added check for parameter, to make sure only valid can pass Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java index 64de36de..e82dd716 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java @@ -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;