You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2004/09/22 12:58:42 UTC

svn commit: rev 47043 - in cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor: . sitemap

Author: cziegeler
Date: Wed Sep 22 03:58:40 2004
New Revision: 47043

Modified:
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
Log:
Fix Sitemap Reloading NPE reported by Vadim

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java	Wed Sep 22 03:58:40 2004
@@ -138,27 +138,37 @@
      * @param manager the component manager to be used by the child processor.
      * @return a new child processor.
      */
-    public TreeProcessor createChildProcessor(
-        ComponentManager manager,
-        Source source)
+    public TreeProcessor createChildProcessor(ComponentManager manager,
+                                              String           actualSource)
     throws Exception {
 
         // Note: lifecycle methods aren't called, since this constructors copies all
         // that can be copied from the parent (see above)
         TreeProcessor child = new TreeProcessor(this, manager);
-        child.source = new DelayedRefreshSourceWrapper(source, lastModifiedDelay);
+        child.resolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
+        child.source = new DelayedRefreshSourceWrapper(child.resolver.resolveURI(actualSource), lastModifiedDelay);
+        
         return child;
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     */
     public void contextualize(Context context) throws ContextException {
         this.context = context;
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.component.Composable#compose(org.apache.avalon.framework.component.ComponentManager)
+     */
     public void compose(ComponentManager manager) throws ComponentException {
         this.manager = manager;
         this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.avalon.excalibur.component.RoleManageable#setRoleManager(org.apache.avalon.excalibur.component.RoleManager)
+     */
     public void setRoleManager(RoleManager rm) {
         this.roleManager = rm;
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java	Wed Sep 22 03:58:40 2004
@@ -30,8 +30,6 @@
 import org.apache.cocoon.components.treeprocessor.TreeProcessor;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
 import org.apache.cocoon.environment.Environment;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
 
 /**
  *
@@ -130,17 +128,7 @@
                 actualSource = source;
             }
             
-            SourceResolver resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
-            try {
-                Source src = resolver.resolveURI(actualSource);
-                try {
-                    processor = this.parentProcessor.createChildProcessor(this.manager, src);
-                } finally {
-                    resolver.release(src);
-                }
-            } finally {
-                this.manager.release(resolver);
-            }
+            processor = this.parentProcessor.createChildProcessor(this.manager, actualSource);
 
             // Associate to the original source
             processors.put(source, processor);