]> git.mxchange.org Git - addressbook-lib.git/blobdiff - src/org/mxchange/addressbook/validator/user/UserIdValidator.java
No caching in a validator, else it cannot be updated
[addressbook-lib.git] / src / org / mxchange / addressbook / validator / user / UserIdValidator.java
index ae994302604d57e70f4e3043151f1e74d9996be9..e8836f6d1aae858dda257bf9e80b49ae102b6ea6 100644 (file)
@@ -57,10 +57,16 @@ public class UserIdValidator extends BaseLongValidator implements Validator {
                // Pre-validation (example: not null, not a string, empty string ...)
                super.preValidate(context, component, value, requiredFileds, false);
 
+               // Cast value
+               Long number = (Long) value;
+
+               // Get status
+               Boolean ifUserExists = this.userBean.ifUserIdExists(number);
+
                // Is the address book id valid?
-               if (!this.userBean.ifUserIdExists((Long) value)) {
+               if (!ifUserExists) {
                        // Is not valid
-                       throw new ValidatorException(new FacesMessage(MessageFormat.format("No user found with id {0}. Please check your link.", value))); //NOI18N
+                       throw new ValidatorException(new FacesMessage(MessageFormat.format("No user found with id {0}. Please check your link.", number))); //NOI18N
                }
 
                // Trace message