You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2004/03/10 15:18:01 UTC

cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap MountNode.java

stephan     2004/03/10 06:18:01

  Modified:    src/java/org/apache/cocoon/components/treeprocessor/sitemap
                        MountNode.java
  Log:
  Throw a more meaningful message than IndexOfOutBoundsException.
  
  Revision  Changes    Path
  1.12      +9 -4      cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
  
  Index: MountNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MountNode.java	5 Mar 2004 13:02:52 -0000	1.11
  +++ MountNode.java	10 Mar 2004 14:18:01 -0000	1.12
  @@ -22,6 +22,7 @@
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
  +import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.pipeline.ProcessingPipeline;
   import org.apache.cocoon.components.treeprocessor.AbstractProcessingNode;
   import org.apache.cocoon.components.treeprocessor.InvokeContext;
  @@ -74,13 +75,17 @@
           Map objectModel = env.getObjectModel();
   
           String resolvedSource = this.source.resolve(context, objectModel);
  -        TreeProcessor processor = getProcessor(resolvedSource);
  -
           String resolvedPrefix = this.prefix.resolve(context, objectModel);
   
  +        if (resolvedSource.length()==0)
  +            throw new ProcessingException("Source of mount statement is empty"); 
  +
  +        TreeProcessor processor = getProcessor(resolvedSource);
  +
           String oldPrefix = env.getURIPrefix();
           String oldURI    = env.getURI();
           String oldContext   = env.getContext();
  +				
           try {
               env.changeContext(resolvedPrefix, resolvedSource);
   
  @@ -99,7 +104,7 @@
               }
           } finally {
               // Restore context
  -			env.setContext(oldPrefix, oldURI, oldContext);
  +            env.setContext(oldPrefix, oldURI, oldContext);
   
               // Turning recomposing as a test, according to:
               // http://marc.theaimsgroup.com/?t=106802211400005&r=1&w=2