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;h=1687b6c9ec5d1d0fd769f6fe62f954022e9866f6;p=jjobs-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/jjobs/beans/user/JobsAdminUserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java index 3714d194..2060923a 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebSessionBean.java @@ -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;