You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Vasanth Amana (JIRA)" <ji...@apache.org> on 2009/09/14 12:24:57 UTC

[jira] Updated: (CONFIGURATION-396) In HierarchicalConfiguration$Node visits the ConfigurationKey points to the parent path in visitAfterChildren call

     [ https://issues.apache.org/jira/browse/CONFIGURATION-396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasanth Amana updated CONFIGURATION-396:
----------------------------------------

    Description: 
When visiting a child the key is aggregated to have the child node name, and a call to visitBeforeChildren and grandChildren's visits are made.

However, before calling  visitAfterChildren,  the resetting of the key to that of it's parent's, seems inconsistent.

Last lines in visit(NodeVisitor visitor, ConfigurationKey key) 

            if (key != null)
            {
                key.setLength(length);
            }
            visitor.visitAfterChildren(this, key);


  was:
When visiting a child the key is aggregated to have the child node name, and a call to visitBeforeChildren and grandChildren's visits are made.

However, before calling  visitAfterChildren,  the resetting of the key to that of it's parent's, seems inconsistent.

public void visit(NodeVisitor visitor, ConfigurationKey key)
        {
            int length = 0;
            if (key != null)
            {
                length = key.length();
                if (getName() != null)
                {
                    key
                            .append(StringUtils
                                    .replace(
                                            isAttribute() ? ConfigurationKey
                                                    .constructAttributeKey(getName())
                                                    : getName(),
                                            String
                                                    .valueOf(ConfigurationKey.PROPERTY_DELIMITER),
                                            ConfigurationKey.ESCAPED_DELIMITER));
                }
            }

            visitor.visitBeforeChildren(this, key);

            for (Iterator it = getChildren().iterator(); it.hasNext()
                    && !visitor.terminate();)
            {
                ((Node) it.next()).visit(visitor, key);
            }
            for (Iterator it = getAttributes().iterator(); it.hasNext()
                    && !visitor.terminate();)
            {
                ((Node) it.next()).visit(visitor, key);
            }

            if (key != null)
            {
                key.setLength(length);
            }
            visitor.visitAfterChildren(this, key);
        }
    }


> In HierarchicalConfiguration$Node visits the ConfigurationKey  points to the parent path in visitAfterChildren call
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-396
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-396
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Vasanth Amana
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When visiting a child the key is aggregated to have the child node name, and a call to visitBeforeChildren and grandChildren's visits are made.
> However, before calling  visitAfterChildren,  the resetting of the key to that of it's parent's, seems inconsistent.
> Last lines in visit(NodeVisitor visitor, ConfigurationKey key) 
>             if (key != null)
>             {
>                 key.setLength(length);
>             }
>             visitor.visitAfterChildren(this, key);

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