You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2002/02/06 00:37:24 UTC

cvs commit: jakarta-turbine-3/src/java/org/apache/turbine/pipeline DefaultTargetValve.java

jmcnally    02/02/05 15:37:24

  Modified:    src/java/org/apache/turbine/pipeline DefaultTargetValve.java
  Log:
  Do not attempt to render a target, if the target is null.
  
  Revision  Changes    Path
  1.9       +26 -15    jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultTargetValve.java
  
  Index: DefaultTargetValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultTargetValve.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultTargetValve.java	24 Jan 2002 03:55:26 -0000	1.8
  +++ DefaultTargetValve.java	5 Feb 2002 23:37:24 -0000	1.9
  @@ -81,7 +81,7 @@
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
    * @author <a href="mailto:mikeh@apache.org">Mike Haberman</a>
    * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
  - * @version $Id: DefaultTargetValve.java,v 1.8 2002/01/24 03:55:26 jvanzyl Exp $
  + * @version $Id: DefaultTargetValve.java,v 1.9 2002/02/05 23:37:24 jmcnally Exp $
    */
   public class DefaultTargetValve
       extends AbstractValve
  @@ -146,20 +146,31 @@
           
           String target = data.getTarget();
   
  -        // Get the template context, already populated by any context
  -        // builders that were found for this target
  -        
  -        TemplateContext context = Module.getTemplateContext( data );
  -
  -        context.put( "template", target ); 
  -
  -        // Resolve the layout template for this target 
  -        
  -        String layout = Turbine.getResolver().getTemplate("layouts", target);
  -
  -        // Use the renderer to render the layout, 
  -
  -        render( data, context, layout );
  +        if ( target != null ) 
  +        {
  +            // Get the template context, already populated by any context
  +            // builders that were found for this target
  +     
  +            TemplateContext context = Module.getTemplateContext( data );
  +            
  +            context.put( "template", target ); 
  +            
  +            // Resolve the layout template for this target 
  +            
  +            String layout = Turbine.getResolver()
  +                .getTemplate("layouts", target);
  +            
  +            // Use the renderer to render the layout, 
  +            
  +            render( data, context, layout );
  +        }
  +        else 
  +        {
  +            if ( log.isDebugEnabled() )
  +            {
  +                log.debug( "[DefaultTargetValve] target was null." );
  +            }
  +        }
       }
   
       protected void render( RunData data, TemplateContext context, String target  )
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>