dgraham 2003/06/03 19:50:58
Modified: src/share/org/apache/struts/validator FieldChecks.java
Log:
Fixed validateRequiredIf() so it would fail on Strings of whitespace
for PR# 20455.
Revision Changes Path
1.9 +14 -10
jakarta-struts/src/share/org/apache/struts/validator/FieldChecks.java
Index: FieldChecks.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/validator/FieldChecks.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FieldChecks.java 22 May 2003 01:05:44 -0000 1.8
+++ FieldChecks.java 4 Jun 2003 02:50:58 -0000 1.9
@@ -226,14 +226,18 @@
i++;
}
- if (required) {
- if ((value != null) && (value.length() > 0)) {
- return true;
- } else {
- errors.add(field.getKey(), Resources.getActionError(request, va,
field));
+ if (required) {
+ if (GenericValidator.isBlankOrNull(value)) {
+ errors.add(
+ field.getKey(),
+ Resources.getActionError(request, va, field));
+
return false;
- }
- }
+
+ } else {
+ return true;
+ }
+ }
return true;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]