You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2014/07/17 23:38:26 UTC
svn commit: r1611486 - in /sling/trunk/tooling/ide:
impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java
impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java
Author: rombert
Date: Thu Jul 17 21:38:25 2014
New Revision: 1611486
URL: http://svn.apache.org/r1611486
Log:
SLING-3765 - Sorting node children can trigger a StackOverFlowError
Ensure that reordering is performed only when the resource child names
and the node child names match perfectly.
Modified:
sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java
Modified: sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java?rev=1611486&r1=1611485&r2=1611486&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java (original)
+++ sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommandTest.java Thu Jul 17 21:38:25 2014
@@ -56,6 +56,13 @@ public class ReorderChildNodesCommandTes
doReorderingTest(asList("first", "second", "third"), asList("first", "third", "second"));
}
+ @Test
+ public void reorderingSkippedDueToDifferentChildren() throws Exception {
+
+ doReorderingTest(asList("first", "second", "third"), asList("first", "fourth", "second"),
+ asList("first", "second", "third"));
+ }
+
private void doReorderingTest(List<String> nodeNames, List<String> resourceNames) throws Exception {
doReorderingTest(nodeNames, resourceNames, null);
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java?rev=1611486&r1=1611485&r2=1611486&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ReorderChildNodesCommand.java Thu Jul 17 21:38:25 2014
@@ -102,10 +102,11 @@ public class ReorderChildNodesCommand ex
traceResourcesAndNodes(children, nodeChildren);
- if (children.size() != nodeChildren.size()) {
+ if (! resourceChildNames.equals(nodeChildNames)) {
getLogger().warn(
- "Different number of children between the local workspace and the repository for path "
- + resourceToReorder.getPath() + ". Reordering will not be performed");
+ "Different child names between the local workspace ( " + resourceChildNames
+ + ") and the repository (" + nodeChildNames + ") for path " + resource.getPath()
+ + ". Reordering will not be performed");
return;
}