From 9c4e36d93e174db00c0d47f44e5f36b71dc39733 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 11 May 2020 04:04:04 +0200 Subject: [PATCH] Please cherry-pick: - updateFooEntity() must not allow null primary keys or those below 1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../department/FinancialsAdminDepartmentSessionBean.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/java/org/mxchange/jcontactsbusiness/model/department/FinancialsAdminDepartmentSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/department/FinancialsAdminDepartmentSessionBean.java index ac304eb..8c59dd8 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/department/FinancialsAdminDepartmentSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/department/FinancialsAdminDepartmentSessionBean.java @@ -153,9 +153,12 @@ public class FinancialsAdminDepartmentSessionBean extends BaseFinancialsEnterpri if (null == department) { // Throw NPE throw new NullPointerException("department is null"); //NOI18N - } else if (department.getDepartmentId() instanceof Long) { - // Should not happen - throw new IllegalArgumentException("department.departmentId should not be set."); //NOI18N + } else if (department.getDepartmentId() == null) { + // Throw NPE again + throw new NullPointerException("department.departmentId is null"); //NOI18N + } else if (department.getDepartmentId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("department.departmentId={0} is not valid", department.getDepartmentId())); //NOI18N } else if (department.getDepartmentCompany() == null) { // Throw NPE throw new NullPointerException("department.departmentCompany is null"); //NOI18N -- 2.39.5