incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r960126 - /sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
Date Fri, 02 Jul 2010 22:24:24 GMT
Author: ieb
Date: Fri Jul  2 22:24:24 2010
New Revision: 960126

URL: http://svn.apache.org/viewvc?rev=960126&view=rev
Log:
SLING-1582 added better information at debug level.

Modified:
    sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java

Modified: sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java?rev=960126&r1=960125&r2=960126&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
(original)
+++ sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
Fri Jul  2 22:24:24 2010
@@ -440,51 +440,60 @@ public class Loader extends BaseImportLo
     throws RepositoryException {
         final URL file = bundle.getEntry(entry);
         final String name = getName(entry);
-
-        if (processedEntries.containsKey(file)) {
-            // this is a consumed node descriptor
-            return;
-        }
-
-        // check for node descriptor
-        URL nodeDescriptor = null;
-        for (String ext : this.contentCreator.getImportProviders().keySet()) {
-            nodeDescriptor = bundle.getEntry(entry + ext);
-            if (nodeDescriptor != null) {
-                break;
+        try {
+            if (processedEntries.containsKey(file)) {
+                // this is a consumed node descriptor
+                return;
+            }
+    
+            // check for node descriptor
+            URL nodeDescriptor = null;
+            for (String ext : this.contentCreator.getImportProviders().keySet()) {
+                nodeDescriptor = bundle.getEntry(entry + ext);
+                if (nodeDescriptor != null) {
+                    break;
+                }
             }
-        }
-
-        // install if it is a descriptor
-        boolean foundProvider = this.contentCreator.getImportProvider(entry) != null;
-
-        Node node = null;
-        if (foundProvider) {
-            if ((node = createNode(parent, name, file, configuration)) != null) {
-                processedEntries.put(file, node);
+    
+            // install if it is a descriptor
+            boolean foundProvider = this.contentCreator.getImportProvider(entry) != null;
+    
+            Node node = null;
+            if (foundProvider) {
+                if ((node = createNode(parent, name, file, configuration)) != null) {
+                    log.debug("Created Node as {} {} ",node.getPath(),name);
+                    processedEntries.put(file, node);
+                } else {
+                    log.warn("No Node created for file {} {} ",file,name);
+                }
+            } else {
+                log.debug("Cant find provider for Entry {} at {} ",entry,name);
             }
-        }
-
-        // otherwise just place as file
-        if ( node == null ) {
-            try {
-                createFile(configuration, parent, file, createdNodes);
-                node = parent.getNode(name);
-            } catch (IOException ioe) {
-                log.warn("Cannot create file node for {}", file, ioe);
+    
+            // otherwise just place as file
+            if ( node == null ) {
+                try {
+                    createFile(configuration, parent, file, createdNodes);
+                    node = parent.getNode(name);
+                } catch (IOException ioe) {
+                    log.warn("Cannot create file node for {}", file, ioe);
+                }
             }
-        }
-        // if we have a descriptor, which has not been processed yet,
-        // process it
-        if (nodeDescriptor != null && processedEntries.get(nodeDescriptor) == null
) {
-            try {
-                this.contentCreator.setIgnoreOverwriteFlag(true);
-                node = createNode(parent, name, nodeDescriptor,
-                                  configuration);
-                processedEntries.put(nodeDescriptor, node);
-            } finally {
-                this.contentCreator.setIgnoreOverwriteFlag(false);
+            // if we have a descriptor, which has not been processed yet,
+            // process it
+            if (nodeDescriptor != null && processedEntries.get(nodeDescriptor) ==
null ) {
+                try {
+                    this.contentCreator.setIgnoreOverwriteFlag(true);
+                    node = createNode(parent, name, nodeDescriptor,
+                                      configuration);
+                    processedEntries.put(nodeDescriptor, node);
+                } finally {
+                    this.contentCreator.setIgnoreOverwriteFlag(false);
+                }
             }
+        } catch ( RepositoryException e ) {
+            log.error("Failed to process process file {} from {}", file, name);
+            throw e;
         }
     }
 



Mime
View raw message