You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2001/03/29 00:22:47 UTC

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

jvanzyl     01/03/28 14:22:47

  Modified:    src/java/org/apache/turbine/services/template
                        TurbineTemplateService.java
  Removed:     src/java/org/apache/turbine/services/template
                        TurbineTemplateService2.java
  Log:
  - updating the template service so that the searching for templates
    can be handed off to the template engine. right now this only
    works for velocity and all the other template services work
    the way they previously did.
  
    for velocity multiple template paths are now supported as well
    as loading from the classpath and jar files. for velocity i still
    have not implemented the standard searching algorithm over multiple
    template paths but i figure this isn't a dire need as multiple
    template paths were not supported before. i need to change velocity
    in order for this to work and i will probably wait until after
    the 1.0 velocity release.
  
  Revision  Changes    Path
  1.20      +343 -187  jakarta-turbine/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
  
  Index: TurbineTemplateService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/template/TurbineTemplateService.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- TurbineTemplateService.java	2001/03/15 20:09:09	1.19
  +++ TurbineTemplateService.java	2001/03/28 22:22:46	1.20
  @@ -54,26 +54,26 @@
    * <http://www.apache.org/>.
    */
   
  -// Java Core Classes
   import java.util.ArrayList;
   import java.util.Hashtable;
   import java.util.List;
  -import java.util.Properties;
  +import java.util.Stack;
   import java.util.StringTokenizer;
   
   import java.io.File;
   
  -import javax.servlet.ServletConfig;
  -
  -// Turbine Utility Classes
   import org.apache.turbine.modules.NavigationLoader;
   import org.apache.turbine.modules.ScreenLoader;
   import org.apache.turbine.util.Log;
   import org.apache.turbine.services.TurbineBaseService;
  +import org.apache.turbine.services.TurbineServices;
   import org.apache.turbine.services.InitializationException;
   import org.apache.turbine.services.resources.TurbineResources;
  +import org.apache.turbine.services.resources.ResourceService;
   import org.apache.turbine.services.servlet.TurbineServlet;
   
  +import org.apache.velocity.runtime.configuration.Configuration;
  +
   /**
    * This service provides a method for mapping templates to their
    * appropriate Screens or Navigations.  It also allows templates to
  @@ -81,58 +81,113 @@
    * template structure.  It also performs caching if turned on in the
    * properties file.
    *
  + * Since everything is keyed off the template variable, 
  + * if data.getParameters().getString("template") returns
  + * /about_us/directions/driving.vm, the search for the 
  + * Screen class is as follows (in order):
  + * 
  + * 1. about_us.directions.Driving 
  + * 2. about_us.directions.Default 
  + * 3. about_us.Default 
  + * 4. Default 
  + * 5. VelocityScreen
  + *
  + * If the template variable does not exist, then VelocityScreen will be 
  + * executed and templates/screens/index.vm will be executed. 
  + * If index.vm is not found or if the template is invalid or Velocity 
  + * execution throws an exception of any reason, then
  + * templates/screens/error.vm will be executed. 
  + * 
  + * For the Layouts and Navigations, the following paths will be 
  + * searched in the layouts and navigations template
  + * subdirectories (in order): 
  + * 
  + * 1./about_us/directions/driving.vm 
  + * 2./about_us/directions/default.vm 
  + * 3./about_us/default.vm 
  + * 4./default.vm 
  + *
    * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
    * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
  - * @version $Id: TurbineTemplateService.java,v 1.19 2001/03/15 20:09:09 jvanzyl Exp $
  + * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  + * @version $Id: TurbineTemplateService.java,v 1.20 2001/03/28 22:22:46 jvanzyl Exp $
    */
  -public class TurbineTemplateService
  -    extends TurbineBaseService
  -    implements TemplateService
  +public class TurbineTemplateService extends TurbineBaseService
  +    implements TemplateService, TemplateEngineService
   {
  -    /** The hashtable used to cache Screen names. */
  +    /** 
  +     * The hashtable used to cache Screen names. 
  +     */
       private Hashtable screenCache = null;
   
  -    /** The hashtable used to cache screen template names. */
  +    /** 
  +     * The hashtable used to cache screen template names. 
  +     */
       private Hashtable templateCache = null;
   
  -    /** The hashtable used to cache Navigation names. */
  -    private Hashtable navCache = null;
  +    /** 
  +     * The hashtable used to cache Navigation names. 
  +     */
  +    private Hashtable navigationCache = null;
   
  -    /** The hashtable used to cache layout template names. */
  +    /** 
  +     * The hashtable used to cache layout template names. 
  +     */
       private Hashtable layoutCache = null;
   
  -    /** Flag set if cache is to be used. */
  +    /** 
  +     * Flag set if cache is to be used. 
  +     */
       private boolean useCache = false;
   
  -    /** Default extension. */
  +    /** 
  +     * Default extension for templates. 
  +     */
       private String extension;
   
  -    /** Default layout template. */
  +    /** 
  +     * Default layout template. 
  +     */
       private String defaultLayoutTemplate;
   
  -    /** Default Navigation module. */
  +    /** 
  +     * Default Navigation module. 
  +     */
       private String defaultNavigation;
   
  -    /** Default Screen module. */
  +    /** 
  +     * Default Screen module. 
  +     */
       private String defaultScreen;
   
  +    /**
  +     * All the paths for the file base template searching.
  +     */
  +    private String[] templateRoot;
  +
       /**
  -     * The absolute paths where the appropriate template engine will
  -     * be searching for templates.
  +     * The template engine that will be used to test whether
  +     * a given template exists. You will notice that this
  +     * service implements the TemplateEngineService: this
  +     * will remain until all the template engines implement
  +     * this interface. Right now only the Velocity service
  +     * implements this interface. The upshot of this is
  +     * that Velocity can locate templates within the capability
  +     * of Velocity and its resource loaders, the other template
  +     * engines are stuck with the file based template hierarchy.
        */
  -    private String[] templateRoot = null;
  +    private TemplateEngineService templateEngineService;
   
       /**
        * Called the first time the Service is used.
        *
  -     * @param config A ServletConfig.
  +     * @exception InitializationException
        */
  -    public void init(ServletConfig config)
  -        throws InitializationException
  +    public void init() throws InitializationException
       {
           try
           {
  -            initTemplate(config);
  +            initTemplate();
               setInit(true);
           }
           catch (Exception e)
  @@ -143,66 +198,88 @@
       }
   
       /**
  -     * TODO: Document this class.
  +     * Initialize the template service.
        *
        * @param config A ServletConfig.
        * @exception Exception, a generic exception.
        */
  -    private void initTemplate(ServletConfig config)
  -        throws Exception
  +    private void initTemplate() throws Exception
       {
  -        useCache = TurbineResources.getBoolean("modules.cache", true);
  -        Properties props = getProperties();
  -
  -        if (useCache)
  +        /*
  +         * Get the configuration for the template service.
  +         */
  +        Configuration config = getConfiguration();
  +        
  +        /**
  +         * Get the name of the template service that will
  +         * be searching for the templates.
  +         */
  +        String templateServiceName = config.getString("template.service.name");
  +        
  +        /**
  +         * Get the instance of the service that will be searching
  +         * for the templates. If we haven't been given a valid
  +         * template service for performing the template search
  +         * then this service will take care it, though it will
  +         * be limited to finding templates in the file system.
  +         */
  +        if (templateServiceName != null)
           {
  -            int layoutSize = Integer
  -                .parseInt(props.getProperty("layout.cache.size", "5"));
  -            int navigationSize = Integer
  -                .parseInt(props.getProperty("navigation.cache.size", "10"));
  -            int screenSize = Integer
  -                .parseInt(props.getProperty("screen.cache.size", "5"));
  -            int templateSize = Integer
  -                .parseInt(props.getProperty("screen.cache.size", "50"));
  -            layoutCache = new Hashtable( (int)(1.25*layoutSize) + 1);
  -            navCache = new Hashtable( (int)(1.25*navigationSize) + 1);
  -            screenCache = new Hashtable( (int)(1.25*screenSize) + 1);
  -            templateCache = new Hashtable( (int)(1.25*templateSize) + 1);
  -        }
  -        // relative to the webapp root directory
  -        String templatePaths = props
  -            .getProperty("template.path", "/templates");
  -
  -        // If possible, transform paths to be webapp root relative.
  -        templatePaths = TurbineServlet.getRealPath(templatePaths);
  -                        
  -
  -        // store the converted paths in service properties for 
  -        // Turbine based providers 
  -        props.put("template.path", templatePaths);
  -
  -        // tokenize the template.path property and assign to an array
  -        String pathSep = System.getProperty("path.separator");
  -        StringTokenizer st = new StringTokenizer(templatePaths,pathSep);
  -        templateRoot = new String[st.countTokens()];
  -        int pos = 0;
  -        while(st.hasMoreTokens())
  +            templateEngineService = (TemplateEngineService)
  +                TurbineServices.getInstance().getService(templateServiceName);
  +        }
  +        else
           {
  -            templateRoot[pos++] = st.nextToken();
  +            templateEngineService = this;
           }
  -
  -        // the extension that is added to layout templates (e.g.)
  -        extension = props.getProperty("default.extension", "html");              
   
  -        // the default modules 
  -        defaultNavigation = props
  -            .getProperty("default.navigation", "TemplateNavigation");
  -        defaultScreen = props.getProperty("default.screen", "TemplateScreen");  
  +        /**
  +         * Get the template paths listed in the TR.props for the
  +         * template service this is required for non-Velocity
  +         * template engines.
  +         */
  +        templateRoot = config.getStringArray("template.path");
  +
  +        /*
  +         * Check to see if we are going to be caching modules.
  +         */
  +        useCache = TurbineResources.getBoolean("module.cache", true);
           
  -        // the default layout template
  -        defaultLayoutTemplate = props
  -            .getProperty("default.layout.template", "/default." + extension);
  +        if (useCache)
  +        {
  +            int layoutSize = config.getInt("layout.cache.size",5);
  +            int navigationSize = config.getInt("navigation.cache.size", 10);
  +            int screenSize = config.getInt("screen.cache.size", 5);
  +            int templateSize = config.getInt("screen.cache.size", 50);
  +            
  +            layoutCache = new Hashtable((int) (1.25*layoutSize) + 1);
  +            navigationCache = new Hashtable((int) (1.25*navigationSize) + 1);
  +            screenCache = new Hashtable((int) (1.25*screenSize) + 1);
  +            templateCache = new Hashtable((int) (1.25*templateSize) + 1);
  +        }
           
  +        /*
  +         * The extension that is added to layout templates.
  +         */
  +        extension = config.getString("default.extension", "vm");
  +
  +        /*
  +         * The default navigation module.
  +         */
  +        defaultNavigation = config.getString(
  +            "default.navigation", "TemplateNavigation");
  +        
  +        /*
  +         * The default screen.
  +         */
  +        defaultScreen = config.getString("default.screen", "TemplateScreen");
  +        
  +        /*
  +         * The default layout template.
  +         */
  +        defaultLayoutTemplate = config.getString(
  +            "default.layout.template", "/default." + extension);
  +        
           if (defaultLayoutTemplate.indexOf('.') == -1)
           {
               defaultLayoutTemplate = defaultLayoutTemplate + "." + extension;
  @@ -259,7 +336,6 @@
           return defaultLayoutTemplate;
       }
   
  -
       /**
        * Locate and return the name of a screen template.
        *
  @@ -268,29 +344,31 @@
        * @return A String with the screen template path.
        * @exception Exception, a generic exception.
        */
  -    public String getScreenTemplateName(String key)
  -        throws Exception
  +    public String getScreenTemplateName(String key) throws Exception
       {
  -        if (name==null)
  +        if (key == null)
  +        {
               throw new Exception ("TurbineTemplateService: " + 
  -                "getLayoutTemplateName() was passed in a null value.");
  +                "getScreenTemplateName() was passed in a null value.");
  +        }                
   
  -        String name = null;
  +        String screenTemplate = null;
   
           if (  useCache && templateCache.containsKey(key) )
           {
  -            name = (String)templateCache.get(key);
  +            screenTemplate = (String) templateCache.get(key);
           }
           else
           {
               String[] names = parseScreenTemplate(key);
  -            name = names[2];
  +            screenTemplate = names[2];
               addToCache( key, names[0], screenCache );
               addToCache( key, names[1], layoutCache );
               addToCache( key, names[2], templateCache );
           }
  -        return name;
  +        return screenTemplate;
       }
  +    
       /**
        * Locate and return the name of a layout template.
        *
  @@ -299,26 +377,27 @@
        * @return A String with the layout template path.
        * @exception Exception, a generic exception.
        */
  -    public String getLayoutTemplateName(String name)
  -        throws Exception
  +    public String getLayoutTemplateName(String key) throws Exception
       {
  -        if (name==null)
  +        if (key == null)
  +        {
               throw new Exception ("TurbineTemplateService: " + 
                   "getLayoutTemplateName() was passed in a null value.");
  +        }                
   
           String layoutName = null;
   
  -        if (  useCache && layoutCache.containsKey(name) )
  +        if (  useCache && layoutCache.containsKey(key) )
           {
  -            layoutName = (String)layoutCache.get(name);
  +            layoutName = (String) layoutCache.get(key);
           }
           else
           {
  -            String[] names = parseScreenTemplate(name);
  +            String[] names = parseScreenTemplate(key);
               layoutName = names[1];
  -            addToCache( name, names[0], screenCache );
  -            addToCache( name, names[1], layoutCache );
  -            addToCache( name, names[2], templateCache );
  +            addToCache( key, names[0], screenCache );
  +            addToCache( key, names[1], layoutCache );
  +            addToCache( key, names[2], templateCache );
           }
           return layoutName;
       }
  @@ -330,25 +409,26 @@
        * @return A String with the name of the navigation.
        * @exception Exception, a generic exception.
        */
  -    public String getNavigationName(String name)
  -        throws Exception
  +    public String getNavigationName(String key) throws Exception
       {
  -        if (name==null)
  +        if (key == null)
  +        {
               throw new Exception ("TurbineTemplateService: " + 
                   "getNavigationName() was passed in a null value.");
  +        }                
   
  -        String nav_name = null;
  +        String navigationName = null;
   
  -        if (  useCache && navCache.containsKey(name) )
  +        if ( useCache && navigationCache.containsKey(key) )
           {
  -            nav_name = (String)navCache.get(name);
  +            navigationName = (String) navigationCache.get(key);
           }
           else
           {
  -            nav_name = parseNavigationTemplate(name);
  -            addToCache( name, nav_name, navCache );
  +            navigationName = parseNavigationTemplate(key);
  +            addToCache( key, navigationName, navigationCache );
           }
  -        return nav_name;
  +        return navigationName;
       }
   
       /**
  @@ -358,13 +438,14 @@
        * @return A String with the name of the screen.
        * @exception Exception, a generic exception.
        */
  -    public String getScreenName(String name)
  -        throws Exception
  +    public String getScreenName(String name) throws Exception
       {
   
  -        if (name==null)
  +        if (name == null)
  +        {
               throw new Exception ("TurbineTemplateService: " + 
                   "getScreenName() was passed in a null value.");
  +        }                
   
           String screenName = null;
   
  @@ -403,64 +484,46 @@
        */
       protected String[] parseScreenTemplate( String template ) throws Exception
       {
  -        // check if an extension was included.  if not, add the default
  +        /*
  +         * Check if an extension was included. 
  +         * If not, add the default.
  +         */
           if ( template.indexOf('.') == -1 )
           {
               template = template + "." + getDefaultExtension(); 
           }
  -
  -        // make sure the template exists and determine the correct
  -        // templateRoot path
  -        String pathRoot = null;
  -        String allPaths = "";
  -        String pathSep = System.getProperty("path.separator");
           
  -        for (int i = 0; i < templateRoot.length; i++)
  -        {
  -            if (new File(templateRoot[i], "screens/" + template).exists())
  -            {
  -                pathRoot = templateRoot[i];
  -                break;
  -            }
  -            allPaths += pathSep + templateRoot[i];
  -        }
  -        if (pathRoot == null)
  +        /*
  +         * Remove any leading "/" characters because we
  +         * are already appending one here. Don't want
  +         * the duplicate "//" sequence in the path.
  +         */
  +        if (template.startsWith("/"))
           {
  -            throw new Exception("The screen template: " +
  -                                template +
  -                                " does not exist in " +
  -                                allPaths.substring(pathSep.length()) +
  -                                ", so the TemplateService could not " +
  -                                "determine associated templates.");
  -        }
  -
  -        StringTokenizer st = new StringTokenizer(template, "/");
  -        List tokens = new ArrayList(st.countTokens());
  +            template = template.substring(1);
  +        }                
           
  -        while(st.hasMoreTokens())
  -        {
  -            String token = st.nextToken();
  -            if (!token.equals(""))
  -            {
  -                tokens.add(token);
  -            }
  -        }
  -        String fileName = (String)tokens.get(tokens.size() - 1);
  -        tokens.remove(tokens.size()-1);
  -        int dot = fileName.lastIndexOf('.');
  -        String className = null;
  -        if (dot>0)
  -        {
  -            className = fileName.substring(0, dot);
  -        }
  -        else
  +        String templateToFind = "screens/" + template;
  +        
  +        if (!templateEngineService.templateExists(templateToFind))
           {
  -            className = fileName;
  +            /*
  +             * We should ask the template engine where it
  +             * looked for templates.
  +             */
  +            throw new Exception("can't find template: " + templateToFind);
           }
  -        String firstChar = String.valueOf(className.charAt(0));
  -        firstChar = firstChar.toUpperCase();
  -        className = firstChar + className.substring(1);
   
  +        Stack tokens = processTemplateName(template);
  +        String className = (String) tokens.pop();
  +        String fileName = (String) tokens.pop();
  +        
  +        /*
  +         * Here we are producing two arrays, the first is
  +         * a list of the paths where the template might
  +         * live, and the second is a list of where the
  +         * screen classes may live in the classpath.
  +         */
           String[] paths = new String[tokens.size() + 2];
           String[] pkgs = new String[tokens.size() + 2];
           int arrayIndex = 0;
  @@ -488,11 +551,45 @@
   
           String[] holder = new String[3];
           holder[0] = getScreenName(pkgs);
  -        holder[1] = getLayoutTemplateName(pathRoot, paths);
  +        holder[1] = getLayoutTemplateName(paths);
           holder[2] = template;
           return holder;
       }
  +    
  +    /**
  +     * Use the companion template engine service to
  +     * determine whether a template exists.
  +     *
  +     * @param String template to search for
  +     * @return boolean
  +     */
  +    public boolean templateExists(String template)
  +    {
  +        /* 
  +         * Make sure the template exists and determine the correct
  +         * templateRoot path.
  +         */
  +        String pathRoot = null;
  +        String allPaths = "";
  +        String pathSep = System.getProperty("path.separator");
  +        
  +        for (int i = 0; i < templateRoot.length; i++)
  +        {
  +            if (new File(templateRoot[i], template).exists())
  +            {
  +                pathRoot = templateRoot[i];
  +                break;
  +            }
  +            allPaths += pathSep + templateRoot[i];
  +        }
  +        if (pathRoot == null)
  +        {
  +            return false;
  +        }
   
  +        return true;
  +    }        
  +
       /**
        * Parse the template name out to a package path to locate the
        * Navigation module.  This is different than the Screen/Layout
  @@ -505,8 +602,64 @@
        */
       protected String parseNavigationTemplate( String template )
       {
  +        Stack tokens = processTemplateName(template);
  +        String className = (String) tokens.pop();
  +        String fileName = (String) tokens.pop();
  +        
  +        String[] pkgs = new String[tokens.size() + 2];
  +        int arrayIndex = 0;
  +        for (int i=tokens.size(); i>=0;  i--)
  +        {
  +            StringBuffer pkg = new StringBuffer();
  +            for (int j=0; j<i; j++)
  +            {
  +                pkg.append((String)tokens.get(j)).append('.');
  +            }
  +            if ( i == tokens.size() )
  +            {
  +                StringBuffer distinctPkg = new StringBuffer(pkg.toString());
  +                pkgs[arrayIndex] = distinctPkg.append(className).toString();
  +                arrayIndex++;
  +            }
  +            pkgs[arrayIndex] = pkg.append("Default").toString();
  +            arrayIndex++;
  +        }
  +        return getNavigationName(pkgs);
  +    }
  +
  +    /**
  +     * Process the template name and return a List that
  +     * contains the tokenized bits of the path to
  +     * the template, the fileName of the template,
  +     * and the class name of the screen that goes
  +     * along with the template.
  +     *
  +     * @param String template
  +     * @return List 
  +     */
  +    private Stack processTemplateName(String template)
  +    {
  +        /*
  +         * Look at the template name that we have been given,
  +         * say for example:
  +         *
  +         * /about_us/directions/driving.vm
  +         *
  +         * and try to determine where a matching Screen
  +         * class might be found.
  +         */
           StringTokenizer st = new StringTokenizer(template, "/");
  -        List tokens = new ArrayList(st.countTokens());
  +        Stack tokens = new Stack();
  +        
  +        /*
  +         * Using our example above we are going to turn:
  +         *
  +         * /about_us/directions/driving.vm
  +         *
  +         * into
  +         *
  +         * [about_us, directions, driving.vm]
  +         */
           while(st.hasMoreTokens())
           {
               String token = st.nextToken();
  @@ -515,10 +668,15 @@
                   tokens.add(token);
               }
           }
  -        String fileName = (String)tokens.get(tokens.size() - 1);
  -        tokens.remove(tokens.size() - 1);
  +        
  +        /*
  +         * The last element in the list is the name of
  +         * our template.
  +         */
  +        String fileName = (String)tokens.pop();
           int dot = fileName.lastIndexOf('.');
           String className = null;
  +        
           if (dot>0)
           {
               className = fileName.substring(0, dot);
  @@ -526,30 +684,12 @@
           else
           {
               className = fileName;
  -        }
  -        String firstChar = String.valueOf(className.charAt(0));
  -        firstChar = firstChar.toUpperCase();
  -        className = firstChar + className.substring(1);
  -
  -        String[] pkgs = new String[tokens.size() + 2];
  -        int arrayIndex = 0;
  -        for (int i=tokens.size(); i>=0;  i--)
  -        {
  -            StringBuffer pkg = new StringBuffer();
  -            for (int j=0; j<i; j++)
  -            {
  -                pkg.append((String)tokens.get(j)).append('.');
  -            }
  -            if ( i == tokens.size() )
  -            {
  -                StringBuffer distinctPkg = new StringBuffer(pkg.toString());
  -                pkgs[arrayIndex] = distinctPkg.append(className).toString();
  -                arrayIndex++;
  -            }
  -            pkgs[arrayIndex] = pkg.append("Default").toString();
  -            arrayIndex++;
           }
  -        return getNavigationName( pkgs);
  +        
  +        tokens.push(fileName);
  +        tokens.push(className);
  +        
  +        return tokens;
       }
   
       /**
  @@ -558,15 +698,21 @@
        * @param possiblePaths A String[] with possible paths to search.
        * @return A String with the name of the layout template.
        */
  -    private String getLayoutTemplateName(String pathRoot, String[] possiblePaths)
  +    private String getLayoutTemplateName(String[] possiblePaths)
       {
  -        for (int i=0; i<possiblePaths.length; i++)
  +        for (int i = 0; i < possiblePaths.length; i++)
           {
  -            if (new File(pathRoot, "layouts" + possiblePaths[i]).exists())
  +            /*
  +             * We are not adjusting anything here "/" character
  +             * wise because the possiblePaths are coming in
  +             * with a prefix of "/".
  +             */
  +            if (templateEngineService.templateExists("layouts" + possiblePaths[i]))
               {
                   return possiblePaths[i];
               }
           }
  +
           return defaultLayoutTemplate;
       }
   
  @@ -579,14 +725,19 @@
        */
       private String getScreenName( String[] possibleScreens)
       {
  -        for (int i=0; i<possibleScreens.length; i++)
  +        for (int i = 0; i < possibleScreens.length; i++)
           {
               try
               {
                   ScreenLoader.getInstance().getInstance(possibleScreens[i]);
                   return possibleScreens[i];
               }
  -            catch (Exception e) {}
  +            catch (Exception e) 
  +            {
  +                /*
  +                 * do nothing.
  +                 */
  +            }
           }
           return defaultScreen;
       }
  @@ -602,14 +753,19 @@
        */
       private String getNavigationName( String[] possibleNavigations)
       {
  -        for (int i=0; i<possibleNavigations.length; i++)
  +        for (int i = 0; i < possibleNavigations.length; i++)
           {
               try
               {
                   NavigationLoader.getInstance().getInstance(possibleNavigations[i]);
                   return possibleNavigations[i];
  +            }
  +            catch (Exception e) 
  +            {
  +                /*
  +                 * do nothing.
  +                 */
               }
  -            catch (Exception e) {}
           }
           return defaultNavigation;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org