cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap CallNode.java
Date Sun, 31 Mar 2002 21:07:48 GMT
sylvain     02/03/31 13:07:48

  Modified:    src/java/org/apache/cocoon/components/treeprocessor/sitemap
                        CallNode.java
  Log:
  Remove unwanted parameter nesting when resolving resource name.
  Reported by: Harry Lai (HLai@coremetrics.com)
  
  Revision  Changes    Path
  1.3       +25 -26    xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallNode.java
  
  Index: CallNode.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/CallNode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CallNode.java	17 Mar 2002 21:55:22 -0000	1.2
  +++ CallNode.java	31 Mar 2002 21:07:48 -0000	1.3
  @@ -69,7 +69,7 @@
   /**
    *
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  - * @version CVS $Id: CallNode.java,v 1.2 2002/03/17 21:55:22 sylvain Exp $
  + * @version CVS $Id: CallNode.java,v 1.3 2002/03/31 21:07:48 sylvain Exp $
    */
   
   public class CallNode extends AbstractProcessingNode
  @@ -110,36 +110,35 @@
       public final boolean invoke(Environment env, InvokeContext context)
         throws Exception {
   
  -        // Resolve parameters
  -        if (this.parameters != null) {
  -            // In redirect-to a level is added to the map stack *only* if the
  -            // 'target' attribute is present.
  -            Map params = MapStackResolver.resolveMap(this.parameters, context.getMapStack());
  -            context.pushMap(params);
  -        }
  -
  -        boolean result;
  +        // Resolve parameters, but push them only once the resource name has been
  +        // resolved, otherwise it adds an unwanted nesting level
  +        Map params = MapStackResolver.resolveMap(this.parameters, context.getMapStack());
   
  -        try {
  -            if (this.resourceNode != null) {
  -                // Static resource name
  -                result = this.resourceNode.invoke(env, context);
  -    
  -            } else {
  -                // Resolved resource name
  -                String name = this.resourceResolver.resolve(context.getMapStack());
  -    
  -                if (getLogger().isInfoEnabled()) {
  -                    getLogger().info("Calling resource " + name);
  -                }
  +        if (this.resourceNode != null) {
  +            // Static resource name
  +            context.pushMap(params);
  +            
  +            try {
  +                return this.resourceNode.invoke(env, context);
  +            } finally {
  +                context.popMap();
  +            }
       
  -                result = this.resources.invokeByName(name, env, context);
  +        } else {
  +            // Resolved resource name
  +            String name = this.resourceResolver.resolve(context.getMapStack());
  +            if (getLogger().isInfoEnabled()) {
  +                getLogger().info("Calling resource " + name);
               }
  -        } finally {
  -            if (this.parameters != null) {
  +            
  +            // and only now push the parameters
  +            context.pushMap(params);
  +            
  +            try {
  +                return this.resources.invokeByName(name, env, context);
  +            } finally {
                   context.popMap();
               }
           }
  -        return result;
       }
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message