Commons Validator
  1. Commons Validator
  2. VALIDATOR-84

Serialization problem with org.apache.commons.validator.ValidatorResult$ResultStatu

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 1.1.0 (alpha)
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      org.apache.struts.validator.DynaValidatorForm serialisation fails because
      class org.apache.commons.validator.ValidatorResult$ResultStatus does not
      implement interface Serializable.

      This is not consistent with other classes of Validator or Struts, so I believe
      it's a bug.

      The correction consists in modifying file ValidatorResult.java at line 132 and
      replacing code:
      protected class ResultStatus {
      by:
      protected class ResultStatus implements Serializable {

        Activity

        Hide
        Martin Cooper added a comment -

        Unfortunately, I don't believe the fix is quite that simple. The problem is
        that ValidatorResult$ResultStatus contains an Object reference, and as far as I
        can determine, that object can be anything at all. Therefore, although we could
        mark ValidatorResult$ResultStatus as implementing Serializable, it would not be
        truly serializable unless all of the validation methods returned serializable
        objects.

        It's not clear to me what we should do about this - it needs the attention of
        someone more familiar with the details of the Validator than I am.

        Show
        Martin Cooper added a comment - Unfortunately, I don't believe the fix is quite that simple. The problem is that ValidatorResult$ResultStatus contains an Object reference, and as far as I can determine, that object can be anything at all. Therefore, although we could mark ValidatorResult$ResultStatus as implementing Serializable, it would not be truly serializable unless all of the validation methods returned serializable objects. It's not clear to me what we should do about this - it needs the attention of someone more familiar with the details of the Validator than I am.
        Hide
        James Turner added a comment -

        My feeling on this is that:

        To date, all validator rules in Apache source either return a boolean
        (pass/fail) or a Serializable type (Date, Long, etc). Therefore, in the
        interest of fixing this problem, I think we should declare that the type of
        any object returned by a validation rule must implement Serializable, and add
        Serializable to the subclass.

        Any objections?

        Show
        James Turner added a comment - My feeling on this is that: To date, all validator rules in Apache source either return a boolean (pass/fail) or a Serializable type (Date, Long, etc). Therefore, in the interest of fixing this problem, I think we should declare that the type of any object returned by a validation rule must implement Serializable, and add Serializable to the subclass. Any objections?
        Hide
        Pierre Chardin added a comment -

        I have no objections.

        Show
        Pierre Chardin added a comment - I have no objections.
        Hide
        Martin Cooper added a comment -

        Fixed in the 20021213 nightly build.

        ValidatorResult$ResultStatus now implements Serializable. The onus is therefore
        on the Validator client to ensure that result classes are serializable.

        Show
        Martin Cooper added a comment - Fixed in the 20021213 nightly build. ValidatorResult$ResultStatus now implements Serializable. The onus is therefore on the Validator client to ensure that result classes are serializable.
        Hide
        Niall Pemberton added a comment -

        Re-openned and the set to "Resolved Fixed" again to correct "resolution" which was lost in Bugzilla --> JIRA conversion

        Show
        Niall Pemberton added a comment - Re-openned and the set to "Resolved Fixed" again to correct "resolution" which was lost in Bugzilla --> JIRA conversion

          People

          • Assignee:
            Unassigned
            Reporter:
            Pierre Chardin
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development