You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jt...@apache.org on 2002/03/11 13:55:18 UTC

cvs commit: jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/template TurbineTemplateService.java

jtaylor     02/03/11 04:55:18

  Modified:    src/services/java/org/apache/fulcrum/template
                        TurbineTemplateService.java
  Log:
  Small change to make templateExists return false when no TemplateEngineService
  is registered for the requested template. Also made the javadoc a little more
  consistent.
  
  I was holding off on this change since when I originally submitted it I was
  told that the template service structure was going to be rewritten, but since
  2.2 integrated with fulcrum is supposed to go out soon, this seems like an
  appropriate fix.
  
  Revision  Changes    Path
  1.7       +26 -6     jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/template/TurbineTemplateService.java
  
  Index: TurbineTemplateService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/template/TurbineTemplateService.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TurbineTemplateService.java	23 Jan 2002 01:00:44 -0000	1.6
  +++ TurbineTemplateService.java	11 Mar 2002 12:55:18 -0000	1.7
  @@ -102,7 +102,7 @@
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
    * @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
  - * @version $Id: TurbineTemplateService.java,v 1.6 2002/01/23 01:00:44 jon Exp $
  + * @version $Id: TurbineTemplateService.java,v 1.7 2002/03/11 12:55:18 jtaylor Exp $
    */
   public class TurbineTemplateService
       extends BaseService
  @@ -161,12 +161,12 @@
       }
   
       /**
  -     * Delegates to the appropriate {@link
  -     * org.apache.fulcrum.template.TemplateEngineService} to
  -     * check the existance of the specified template.
  +     * Looks for the specified template file in each of the specified paths.
        *
  -     * @param template The template to check for the existance of.
  +     * @param template The template file to check for the existance of.
        * @param templatePaths The paths to check for the template.
  +     *
  +     * @return true if a match is found in one of the supplied paths, or false.
        */
       public boolean templateExists(String template,
                                     String[] templatePaths)
  @@ -181,10 +181,30 @@
           return false;
       }
   
  +    /**
  +     * Determine if a template exists. Delegates to the appropriate {@link 
  +     * org.apache.fulcrum.template.TemplateEngineService} to check the 
  +     * existance of the specified template. If no template engine service is
  +     * found for the template, false is returned.
  +     * 
  +     * @param template The template file to check for the existence of.
  +     *
  +     * @return true if there is a template engine service registered for the
  +     *         given template, and it reports that the template exists, 
  +     *         otherwise false.
  +     */
       public boolean templateExists(String template)
       {
           TemplateEngineService tes = getTemplateEngineService(template);
  -        return tes.templateExists(template);
  +
  +        if (tes != null)
  +        {
  +            return tes.templateExists(template);
  +        }
  +        else
  +        {
  +            return false;
  +        }
       }
   
       /**
  
  
  

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