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=bf35f36444f31d794a9bf5f0cf84fbf3534a580f;p=jfinancials-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/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java index afd96c37..7affb064 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java @@ -601,6 +601,14 @@ public class AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW @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;