You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2010/11/09 01:08:09 UTC
[jira] Assigned: (WICKET-3153) Form Bytes getMaxSize never returns
null and does not find maximum
[ https://issues.apache.org/jira/browse/WICKET-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg reassigned WICKET-3153:
-------------------------------------
Assignee: Igor Vaynberg
> Form Bytes getMaxSize never returns null and does not find maximum
> ------------------------------------------------------------------
>
> Key: WICKET-3153
> URL: https://issues.apache.org/jira/browse/WICKET-3153
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5-M2.1
> Environment: Independent of environment
> Reporter: Richard Emberson
> Assignee: Igor Vaynberg
> Priority: Minor
>
> In org/apache/wicket/markup/html/form/Form the method getMaxSize
> always returns a Bytes instance.
> public Bytes getMaxSize() {
> Bytes maxSize = this.maxSize;
> if (maxSize == null) {
> maxSize = visitChildren(Form.class, new IVisitor<Form<?>, Bytes>() {
> public void component(Form<?> component, IVisit<Bytes> visit) {
> Bytes maxSize = component.getMaxSize();
> if (maxSize != null) {
> visit.stop(maxSize);
> }
> }
> });
> }
> if (maxSize == null) {
> return
> getApplication().getApplicationSettings().getDefaultMaximumUploadSize();
> }
> return maxSize;
> }
> Because during the visit traversal, the VERY FIRST Form visited returns
> a non-null getMaxSize value. Even it its this.maxSize is null, it
> will then return getDefaultMaximumUploadSize.
> I suspect what is needed is a isMaxSizeSet method.
> The inner visit method would then be:
> if (component.isMaxSizeSet()) {
> Bytes maxSize = component.getMaxSize();
> visit.stop(maxSize);
> }
> With this, then it is only the Form creating and calling the Visitor
> that returns the getDefaultMaximumUploadSize value, and only if
> none of its sub Forms have an explicit value.
> Also, should the Visitor actually look for the maximum size value
> of the children and return it rather than returning the first
> value (which may not be the maximum)???
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.