From: Roland Häder Date: Mon, 11 May 2020 02:04:04 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9c4e36d93e174db00c0d47f44e5f36b71dc39733;p=jfinancials-ejb.git Please cherry-pick: - updateFooEntity() must not allow null primary keys or those below 1 Signed-off-by: Roland Häder --- 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