]> git.mxchange.org Git - jfinancials-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Mon, 11 May 2020 02:04:04 +0000 (04:04 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 11 May 2020 02:04:04 +0000 (04:04 +0200)
- updateFooEntity() must not allow null primary keys or those below 1

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jcontactsbusiness/model/department/FinancialsAdminDepartmentSessionBean.java

index ac304eb4ed5991e3a178b4dea688c2c072bb6d15..8c59dd887b56b862f5b67e237cc61a1c2ac9950a 100644 (file)
@@ -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