*/
package org.mxchange.jusercore.container.login;
+import java.text.MessageFormat;
import org.mxchange.jusercore.model.user.User;
/**
// Is both set?
if (null == user) {
// Throw NPE
- throw new NullPointerException("user is null");
+ throw new NullPointerException("user is null"); //NOI18N
+ } else if (user.getUserId() == null) {
+ // Throw NPE again ..
+ throw new NullPointerException("user.userId is null"); //NOI18N
+ } else if (user.getUserId() < 1) {
+ // Invalid id number
+ throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
+ } else if (user.getUserContact() == null) {
+ // Throw NPE again ...
+ throw new NullPointerException("user.userContact is null"); //NOI18N
+ } else if (user.getUserContact().getContactId() == null) {
+ // Throw NPE again ...
+ throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
+ } else if (user.getUserContact().getContactId() < 1) {
+ // Invalid id number
+ throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is not valid", user.getUserContact().getContactId())); //NOI18N
} else if (null == userPassword) {
// Throw NPE again
- throw new NullPointerException("userPassword is null");
+ throw new NullPointerException("userPassword is null"); //NOI18N
} else if (userPassword.isEmpty()) {
// Empty password
- throw new IllegalArgumentException("user password is empty.");
+ throw new IllegalArgumentException("user password is empty."); //NOI18N
}
// Set both