nbubna      2003/02/17 20:36:10

  Modified:    view/src/java/org/apache/velocity/tools/view/servlet
                        VelocityLayoutServlet.java
  Log:
  be more resilient about $layout type (bug #17151 - Tim Vernum)
  
  Revision  Changes    Path
  1.2       +4 -3      
jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/servlet/VelocityLayoutServlet.java
  
  Index: VelocityLayoutServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/servlet/VelocityLayoutServlet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VelocityLayoutServlet.java        24 Jan 2003 04:05:24 -0000      1.1
  +++ VelocityLayoutServlet.java        18 Feb 2003 04:36:10 -0000      1.2
  @@ -259,7 +259,8 @@
           // we check after merging the screen template so the screen 
           // can overrule any layout set in the request parameters
           // by doing #set( $layout = "MyLayout.vm" )
  -        String layout = (String)context.get(KEY_LAYOUT);
  +        Object obj = context.get(KEY_LAYOUT);
  +        String layout = (obj == null) ? null : obj.toString();
           if (layout == null) 
           {
               // no alternate, use default
  @@ -281,7 +282,7 @@
               Velocity.error("Can't load layout \"" + layout + "\": " + e);
   
               // if it was an alternate layout we couldn't get...
  -            if (layout != defaultLayout) 
  +            if (!layout.equals(defaultLayout)) 
               {
                   // try to get the default layout
                   // if this also fails, let the exception go
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to