Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2688

Versioned form with FileUploadField will expire page if you submit the form twice.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.5
    • 1.4.7, 1.5-M1
    • wicket
    • None

    Description

      If a form has FileUploadField and versioned, Page, on which the form is, will be expired at second post of the form.
      run a attached project file. In this sample program, onSubmit() method of Form always displays same page with an error message. Post the form again, then page will be expired.

      This problem will occur if a versioned property of FileUploadField is true. If the property is false, this problem never occurs.

      If you use setVersioned() method of Form with FileUploadField, the 'versioned' property of the FileUploadField becomes true automatically, so this problem easily occurs in the timing not anticipated.

      I noticed version number of page up twice on 'detach' time, if FileUploadField is versioned.

      I expect, this problem might occur only for components with isMultiPart() == true, although I could not found the evidence.
      If so, 'versioned' property of such component must never become true. In addition, setVersioned() method of Form component should check children are Multipart or not, like below.

      @Override
      public final Component setVersioned(final boolean isVersioned)
      {
      super.setVersioned(isVersioned);

      // Search for FormComponents like TextField etc.
      visitFormComponents(new FormComponent.AbstractVisitor()
      {
      @Override
      public void onFormComponent(final FormComponent<?> formComponent)
      {
      if(!formComponent.isMultiPart())

      { //set true only if the child is not multipart component. formComponent.setVersioned(isVersioned); }

      }
      });
      return this;
      }

      Attachments

        1. WICKET-2688.patch
          1 kB
          Martin Grigorov
        2. wicket-bugtest.zip
          20 kB
          Tsutomu YANO

        Activity

          People

            ivaynberg Igor Vaynberg
            t_yano Tsutomu YANO
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: