Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-1495

Bug in FieldChecks.validateRequiredIf(...)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Nightly Build
    • 1.1 Family
    • Core
    • None
    • Operating System: All
      Platform: All
    • 20455

    Description

      I have a validation that should be failing (under certain conditions),
      but is not. I've double checked and triple checked to make sure the
      setup is correct, and it's still not working correctly.

      So, I took a look at the code for "validateRequiredIf" in
      the "org.apache.struts.validator.FieldChecks" class. At the end of
      the method I found this segment of code:

      if (required) {
      if ((value != null) && (value.length() > 0))

      { return true; }

      else

      { errors.add(field.getKey(), Resources.getActionError(request, va, field)); return false; }

      }

      Am I correct in assuming that the following condition "((value != null) &&
      (value.length() > 0))" should be "(!GenericValidator.isBlankOrNull(value))".
      The reason my check is failing is due to the fact the value I'm checking is
      all white space (at certain times), and is selected from a select box.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bhandy@users.sf.net Bradley M. Handy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: