Fixed in SVN. Thank you for the good catch. Gary
On Thu, Apr 20, 2017 at 5:59 AM, Gary Gregory <garydgreg...@gmail.com> wrote: > > > On Apr 20, 2017 2:40 AM, "Oliver Heger" <oliver.he...@oliver-heger.de> > wrote: > > > > Am 20.04.2017 um 05:17 schrieb ggreg...@apache.org: > >> Author: ggregory >> Date: Thu Apr 20 03:17:59 2017 >> New Revision: 1792011 >> >> URL: http://svn.apache.org/viewvc?rev=1792011&view=rev >> Log: >> [CONFIGURATION-664] Add API org.apache.commons.configurati >> on2.tree.ImmutableNode.getChildren(String). >> >> Modified: >> commons/proper/configuration/trunk/src/changes/changes.xml >> commons/proper/configuration/trunk/src/main/java/org/apache/ >> commons/configuration2/tree/ImmutableNode.java >> commons/proper/configuration/trunk/src/test/java/org/apache/ >> commons/configuration2/tree/TestImmutableNode.java >> >> Modified: commons/proper/configuration/trunk/src/changes/changes.xml >> URL: http://svn.apache.org/viewvc/commons/proper/configuration/tr >> unk/src/changes/changes.xml?rev=1792011&r1=1792010&r2=1792011&view=diff >> ============================================================ >> ================== >> --- commons/proper/configuration/trunk/src/changes/changes.xml (original) >> +++ commons/proper/configuration/trunk/src/changes/changes.xml Thu Apr >> 20 03:17:59 2017 >> @@ -41,6 +41,9 @@ >> <action dev="ggregory" type="add" issue="CONFIGURATION-658"> >> Add API org.apache.commons.configurati >> on2.DataConfiguration.getURI(String) methods. >> </action> >> + <action dev="ggregory" type="add" issue="CONFIGURATION-664"> >> + Add API org.apache.commons.configurati >> on2.tree.ImmutableNode.getChildren(String). >> + </action> >> <action dev="ggregory" type="update" issue="CONFIGURATION-661"> >> Update platform requirement from Java 6 to 7. >> </action> >> >> Modified: commons/proper/configuration/trunk/src/main/java/org/apache/ >> commons/configuration2/tree/ImmutableNode.java >> URL: http://svn.apache.org/viewvc/commons/proper/configuration/tr >> unk/src/main/java/org/apache/commons/configuration2/tree/Imm >> utableNode.java?rev=1792011&r1=1792010&r2=1792011&view=diff >> ============================================================ >> ================== >> --- commons/proper/configuration/trunk/src/main/java/org/apache/ >> commons/configuration2/tree/ImmutableNode.java (original) >> +++ commons/proper/configuration/trunk/src/main/java/org/apache/ >> commons/configuration2/tree/ImmutableNode.java Thu Apr 20 03:17:59 2017 >> @@ -102,6 +102,29 @@ public final class ImmutableNode >> } >> >> /** >> + * Returns a list with the children of this node. This list cannot be >> + * modified. >> + * @param name the node name to find >> + * >> + * @return a list with the child nodes >> + */ >> + public List<ImmutableNode> getChildren(final String name) >> + { >> + final List<ImmutableNode> list = new ArrayList<>(); >> + if (name == null) { >> + return list; >> + } >> + for (final ImmutableNode node : children) >> + { >> + if (name.equals(node.getNodeName())) >> + { >> + list.add(node); >> + } >> + } >> + return list; >> + } >> > > The list does not seem to be unmodifiable. Or do you mean that modifying > the list does not impact the child nodes? I think the implementation is not > aligned with the comment. > > > The comment is wrong. Will fix today, thank you! > > Gary > > > Oliver > > > + >> + /** >> * Returns a map with the attributes of this node. This map cannot be >> * modified. >> * >> >> Modified: commons/proper/configuration/trunk/src/test/java/org/apache/ >> commons/configuration2/tree/TestImmutableNode.java >> URL: http://svn.apache.org/viewvc/commons/proper/configuration/tr >> unk/src/test/java/org/apache/commons/configuration2/tree/Tes >> tImmutableNode.java?rev=1792011&r1=1792010&r2=1792011&view=diff >> ============================================================ >> ================== >> --- commons/proper/configuration/trunk/src/test/java/org/apache/ >> commons/configuration2/tree/TestImmutableNode.java (original) >> +++ commons/proper/configuration/trunk/src/test/java/org/apache/ >> commons/configuration2/tree/TestImmutableNode.java Thu Apr 20 03:17:59 >> 2017 >> @@ -30,6 +30,7 @@ import java.util.Iterator; >> import java.util.List; >> import java.util.Map; >> >> +import org.junit.Assert; >> import org.junit.Test; >> >> /** >> @@ -404,6 +405,49 @@ public class TestImmutableNode >> } >> >> /** >> + * Tests getting named children. >> + */ >> + @Test >> + public void testGetChildrenByName() >> + { >> + ImmutableNode node = createDefaultNode(VALUE); >> + ImmutableNode child2 = >> + new ImmutableNode.Builder().name("child2").create(); >> + ImmutableNode node2 = node.addChild(child2); >> + checkUpdatedNode(node, node2); >> + assertEquals("child2", node2.getChildren("child2").ge >> t(0).getNodeName()); >> + assertEquals(child2, node2.getChildren("child2").get(0)); >> + } >> + >> + /** >> + * Tests getting named children. >> + */ >> + @Test >> + public void testGetChildrenByNullName() >> + { >> + ImmutableNode node = createDefaultNode(VALUE); >> + ImmutableNode child2 = >> + new ImmutableNode.Builder().name("child2").create(); >> + ImmutableNode node2 = node.addChild(child2); >> + checkUpdatedNode(node, node2); >> + assertTrue(node2.getChildren(null).isEmpty()); >> + } >> + >> + /** >> + * Tests getting named children. >> + */ >> + @Test >> + public void testGetChildrenByMissingName() >> + { >> + ImmutableNode node = createDefaultNode(VALUE); >> + ImmutableNode child2 = >> + new ImmutableNode.Builder().name("child2").create(); >> + ImmutableNode node2 = node.addChild(child2); >> + checkUpdatedNode(node, node2); >> + assertTrue(node2.getChildren("NotFound").isEmpty()); >> + } >> + >> + /** >> * Tests whether a new null child node is rejected. >> */ >> @Test(expected = IllegalArgumentException.class) >> >> >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > > -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with Hibernate, Second Edition <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459> JUnit in Action, Second Edition <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021> Spring Batch in Action <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory