From: Roland Häder <roland@mxchange.org>
Date: Thu, 4 Aug 2016 09:50:46 +0000 (+0200)
Subject: Fixed: (please cherry-pick)
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fe27768d035dc4de4ea112cca121201c50ab462e;p=jjobs-mailer-ejb.git

Fixed: (please cherry-pick)
- wrong check, opps, copy-paste mistake: user.userId must be valid set
  as the user is going to be linked with password history entry.
---

diff --git a/src/java/org/mxchange/jusercore/model/user/password_history/LandingUserPasswordHistorySessionBean.java b/src/java/org/mxchange/jusercore/model/user/password_history/LandingUserPasswordHistorySessionBean.java
index 1c78026..fa3461c 100644
--- a/src/java/org/mxchange/jusercore/model/user/password_history/LandingUserPasswordHistorySessionBean.java
+++ b/src/java/org/mxchange/jusercore/model/user/password_history/LandingUserPasswordHistorySessionBean.java
@@ -52,9 +52,12 @@ public class LandingUserPasswordHistorySessionBean extends BaseLandingDatabaseBe
 		if (null == user) {
 			// Abort here
 			throw new NullPointerException("user is null"); //NOI18N
-		} else if (user.getUserId() != null) {
-			// Not allowed here
-			throw new IllegalStateException(MessageFormat.format("user.userId must be null, is: {0}", user.getUserId())); //NOI18N
+		} else if (user.getUserId() == null) {
+			// Throw NPE again
+			throw new NullPointerException("user.userId is null"); //NOI18N
+		} else if (user.getUserId() < 1) {
+			// Illegal id number
+			throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not allowed.", user.getUserId())); //NOI18N
 		}
 
 		// Get named query