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 2017/11/07 09:46:31 UTC

[sling-org-apache-sling-jcr-contentloader] 05/36: SLING-545 Apply modified patch (see issue for modification details)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.contentloader-2.0.4-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentloader.git

commit b748cf1319cf88926c945719a8393ea3bea5c186
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Thu Jun 19 12:35:30 2008 +0000

    SLING-545 Apply modified patch (see issue for modification details)
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/jcr/contentloader@669469 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/jcr/contentloader/internal/Loader.java   | 26 +++++++++++++---------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java b/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
index ca6c28f..53f9d2f 100644
--- a/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
+++ b/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
@@ -295,13 +295,14 @@ public class Loader {
             return;
         }
 
-        Set<URL> ignoreEntry = new HashSet<URL>();
+        Map<URL, Node> processedEntries = new HashMap<URL, Node>();
 
         // potential root node import/extension
         URL rootNodeDescriptor = importRootNode(parent.getSession(), bundle,
             path, versionables, checkin);
         if (rootNodeDescriptor != null) {
-            ignoreEntry.add(rootNodeDescriptor);
+            processedEntries.put(rootNodeDescriptor,
+                parent.getSession().getRootNode());
         }
 
         while (entries.hasMoreElements()) {
@@ -325,11 +326,13 @@ public class Loader {
                 // otherwise call createFolder, which creates an nt:folder or
                 // returns an existing node (created by a descriptor)
                 Node node = null;
-                if (nodeDescriptor != null
-                    && !ignoreEntry.contains(nodeDescriptor)) {
-                    node = createNode(parent, name, nodeDescriptor, overwrite,
-                        versionables, checkin);
-                    ignoreEntry.add(nodeDescriptor);
+                if (nodeDescriptor != null) {
+                    node = processedEntries.get(nodeDescriptor);
+                    if (node == null) {
+                        node = createNode(parent, name, nodeDescriptor,
+                            overwrite, versionables, checkin);
+                        processedEntries.put(nodeDescriptor, node);
+                    }
                 } else {
                     node = createFolder(parent, name, overwrite);
                 }
@@ -344,7 +347,7 @@ public class Loader {
                 
                 // file => create file
                 URL file = bundle.getEntry(entry);
-                if (ignoreEntry.contains(file)) {
+                if (processedEntries.containsKey(file)) {
                     // this is a consumed node descriptor
                     continue;
                 }
@@ -359,9 +362,10 @@ public class Loader {
                     }
                 }
                 if (foundProvider) {
-                    if (createNode(parent, getName(entry), file, overwrite,
-                        versionables, checkin) != null) {
-                        ignoreEntry.add(file);
+                    Node node = null;
+                    if ((node = createNode(parent, getName(entry), file, overwrite,
+                        versionables, checkin)) != null) {
+                        processedEntries.put(file, node);
                         continue;
                     }
                 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.