]> git.mxchange.org Git - addressbook-ejb.git/commitdiff
Fixed: (please cherry-pick)
authorRoland Häder <roland@mxchange.org>
Thu, 4 Aug 2016 09:50:46 +0000 (11:50 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 6 Aug 2016 20:50:52 +0000 (22:50 +0200)
- wrong check, opps, copy-paste mistake: user.userId must be valid set
  as the user is going to be linked with password history entry.

src/java/org/mxchange/jusercore/model/user/password_history/LandingUserPasswordHistorySessionBean.java

index 1c78026f2332a2191cefa873b114bdff31bebca6..fa3461c91fd6da3006faba618453545a6f4c57a5 100644 (file)
@@ -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