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

MarkupContainer - Method-variable children was stepping-on/masking the global-variable children

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Invalid
    • 1.4-RC1
    • 1.4-RC2
    • wicket
    • None
    • 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)

    Description

      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:

      1. This patch file was generated by NetBeans IDE
      2. Following Index: paths are relative to: /home/athomson/Java/Wicket/wicket-svn/wicket/src/main/java/org/apache/wicket
      3. This patch can be applied using context Tools: Patch action on respective folder.
      4. It uses platform neutral UTF-8 encoding and \n newlines.
      5. 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

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jdonnerstag Juegen Donnerstag
            athomson Andy Thomson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment