]> git.mxchange.org Git - jcore-utils.git/commitdiff
also allow null here, if requested + log value
authorRoland Haeder <roland@mxchange.org>
Mon, 12 Oct 2015 09:58:34 +0000 (11:58 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 12 Oct 2015 09:58:34 +0000 (11:58 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/jcoreee/validator/bool/BaseBooleanValidator.java
src/org/mxchange/jcoreee/validator/number/BaseLongValidator.java
src/org/mxchange/jcoreee/validator/string/BaseStringValidator.java

index 57ccb3b60b79e5cf8f0f8c5100c38c833ccd1792..5ddf0fff58c7b48664b407b84bfefc933b57af3c 100644 (file)
@@ -62,7 +62,7 @@ public abstract class BaseBooleanValidator extends BaseObjectValidator implement
                                // Compare value's type
                                if (!(value instanceof Boolean)) {
                                        // Generate message
-                                       requiredMessage = MessageFormat.format("Field {0} is not Boolean.", field); //NOI18N
+                                       requiredMessage = MessageFormat.format("Field {0} is not Boolean: {1}", field, value); //NOI18N
 
                                        // Value is not right type
                                        facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessage, requiredMessage); //NOI18N
index b5475d09e10fa59b53b6d2c710c3036fb4383bd1..dcfbd8c46ccc6736660a4550bbcc65a2347d8ad0 100644 (file)
@@ -57,9 +57,9 @@ public abstract class BaseLongValidator extends BaseObjectValidator implements V
                        // Is it the same?
                        if (clientId.endsWith(field)) {
                                // Compare value's type
-                               if (!(value instanceof Long)) {
+                               if ((!allowNull) && (!(value instanceof Long))) {
                                        // Generate message
-                                       requiredMessage = MessageFormat.format("Field {0} is not Long.", field); //NOI18N
+                                       requiredMessage = MessageFormat.format("Field {0} is not Long.: {1}", field, value); //NOI18N
 
                                        // Value is not right type
                                        facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessage, requiredMessage); //NOI18N
index 159fc500618a3d5e1aac1af9b9e77064d5c605b1..02bb160374b7628bf83b883078fdd547552fcbe5 100644 (file)
@@ -56,9 +56,9 @@ public abstract class BaseStringValidator extends BaseObjectValidator {
                        // Is it the same?
                        if (clientId.endsWith(field)) {
                                // Compare value's type
-                               if (!(value instanceof String)) {
+                               if ((!allowNull) && (!(value instanceof String))) {
                                        // Value is empty
-                                       facesMessage = new FacesMessage(MessageFormat.format("Field {0} is not set to String.", field)); //NOI18N
+                                       facesMessage = new FacesMessage(MessageFormat.format("Field {0} is not String: {1}", field, value)); //NOI18N
                                }
 
                                // Cast to string