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

                 Key: WICKET-2688
                 URL: https://issues.apache.org/jira/browse/WICKET-2688
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.4.5
            Reporter: Tsutomu YANO


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;
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to