From bf35f36444f31d794a9bf5f0cf84fbf3534a580f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 19 Apr 2016 14:26:24 +0200 Subject: [PATCH] Added check for parameter, to make sure only valid can pass MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../beans/user/AddressbookAdminUserWebSessionBean.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- 2.39.5