[
https://issues.apache.org/jira/browse/WICKET-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Juergen Donnerstag resolved WICKET-2044.
----------------------------------------
Resolution: Invalid
Fix Version/s: 1.4-RC2
Assignee: Juergen Donnerstag
though you might argue that using the same variable name on class and method
level could more easily lead to confusion, you still can access the class level
variable via "this.children". It is supported by Java and it is syntactically
correct. I was not able to identify a line where we referenced the wrong
children variable which likely would lead to a wrong behavior of
MarkupContainer. Since you didn't describe a misbehavior of MarkupContainer
neither, I'm closing that issue.
> MarkupContainer - Method-variable children was stepping-on/masking the
> global-variable children
> -----------------------------------------------------------------------------------------------
>
> Key: WICKET-2044
> URL: https://issues.apache.org/jira/browse/WICKET-2044
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4-RC1
> Environment: Linux ubuntu 2.6.24-23-generic #1 SMP Thu Nov 27
> 18:13:46 UTC 2008 x86_64 GNU/Linux
> java version "1.6.0_07"
> Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
> Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)
> Reporter: Andy Thomson
> Assignee: Juergen Donnerstag
> Priority: Minor
> Fix For: 1.4-RC2
>
>
> org.apache.wicket.MarkupContainer
> Method variable children was stepping-on/masking the global variable children
> in the children_get(), children_indexOf(), children_set() and
> onBeforeRenderChildren(). The simple solution was to rename the local method
> children to gchildren.
> Could not attach diff, so it's pasted below:
> # This patch file was generated by NetBeans IDE
> # Following Index: paths are relative to:
> /home/athomson/Java/Wicket/wicket-svn/wicket/src/main/java/org/apache/wicket
> # This patch can be applied using context Tools: Patch action on respective
> folder.
> # It uses platform neutral UTF-8 encoding and \n newlines.
> # Above lines and this line are ignored by the patching process.
> Index: MarkupContainer.java
> --- MarkupContainer.java Base (BASE)
> +++ MarkupContainer.java Locally Modified (Based On LOCAL)
> @@ -1043,21 +1043,21 @@
> }
> else
> {
> - Object[] children = null;
> + Object[] gchildren = null;
> if (this.children instanceof ChildList)
> {
> // we have a list
> - children =
> ((ChildList)this.children).childs;
> + gchildren =
> ((ChildList)this.children).childs;
> }
> else
> {
> // we have a object array
> - children = (Object[])this.children;
> + gchildren = (Object[])this.children;
> }
> - component = postprocess(children[index],
> reconstruct, this, index);
> - if (children[index] != component)
> + component = postprocess(gchildren[index],
> reconstruct, this, index);
> + if (gchildren[index] != component)
> {
> - children[index] = component;
> + gchildren[index] = component;
> }
> }
> }
> @@ -1112,26 +1112,26 @@
> }
> else
> {
> - Object[] children = null;
> + Object[] gchildren = null;
> int size = 0;
> if (this.children instanceof ChildList)
> {
> - children = ((ChildList)this.children).childs;
> + gchildren = ((ChildList)this.children).childs;
> size = ((ChildList)this.children).size;
> }
> else
> {
> - children = (Object[])this.children;
> - size = children.length;
> + gchildren = (Object[])this.children;
> + size = gchildren.length;
> }
> for (int i = 0; i < size; i++)
> {
> - if (getId(children[i]).equals(id))
> + if (getId(gchildren[i]).equals(id))
> {
> - component =
> (Component)postprocess(children[i], true, this, i);
> - if (children[i] != component)
> + component =
> (Component)postprocess(gchildren[i], true, this, i);
> + if (gchildren[i] != component)
> {
> - children[i] = component;
> + gchildren[i] = component;
> }
> break;
> }
> @@ -1161,21 +1161,21 @@
> else
> {
> int size = 0;
> - Object[] children;
> + Object[] gchildren;
> if (this.children instanceof Object[])
> {
> - children = (Object[])this.children;
> - size = children.length;
> + gchildren = (Object[])this.children;
> + size = gchildren.length;
> }
> else
> {
> - children = ((ChildList)this.children).childs;
> + gchildren = ((ChildList)this.children).childs;
> size = ((ChildList)this.children).size;
> }
>
> for (int i = 0; i < size; i++)
> {
> - if (getId(children[i]).equals(child.getId()))
> + if (getId(gchildren[i]).equals(child.getId()))
> {
> return i;
> }
> @@ -1282,9 +1282,9 @@
> }
> else
> {
> - final Object[] children =
> (Object[])this.children;
> - replaced = children[index];
> - children[index] = child;
> + final Object[] gchildren =
> (Object[])this.children;
> + replaced = gchildren[index];
> + gchildren[index] = child;
> }
> }
> }
> @@ -1698,14 +1698,14 @@
>
> // We need to copy the children list because the children
> components can
> // modify the hierarchy in their onBeforeRender.
> - Component[] children = copyChildren();
> + Component[] gchildren = copyChildren();
> try
> {
> // Loop through child components
> - for (int i = 0; i < children.length; i++)
> + for (int i = 0; i < gchildren.length; i++)
> {
> // Get next child
> - final Component child = children[i];
> + final Component child = gchildren[i];
>
> // Call begin request on the child
> // We need to check whether the child's wasn't
> removed from the
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.