- wrong check, opps, copy-paste mistake: user.userId must be valid set
as the user is going to be linked with password history entry.
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