sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1744381 - /sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/sling/ResourceTraversor.java
Date Wed, 18 May 2016 10:33:32 GMT
Author: bdelacretaz
Date: Wed May 18 10:33:32 2016
New Revision: 1744381

URL: http://svn.apache.org/viewvc?rev=1744381&view=rev
Log:
SLING-5578 - remove unnecessary recursion, patch contributed by Marius Petria, thanks! Tests
pass now with -Dsling.test.ResourceTraversor.count=20000

Modified:
    sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/sling/ResourceTraversor.java

Modified: sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/sling/ResourceTraversor.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/sling/ResourceTraversor.java?rev=1744381&r1=1744380&r2=1744381&view=diff
==============================================================================
--- sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/sling/ResourceTraversor.java
(original)
+++ sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/sling/ResourceTraversor.java
Wed May 18 10:33:32 2016
@@ -108,6 +108,11 @@ public class ResourceTraversor {
             }
         }
 
+        // do processing only at first level to avoid unnecessary recursion
+        if (currentLevel > 0) {
+            return -1;
+        }
+
         while (!currentQueue.isEmpty() || !nextQueue.isEmpty()) {
             if (currentQueue.isEmpty()) {
                 currentLevel++;



Mime
View raw message