You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by nb...@apache.org on 2004/11/10 21:17:17 UTC

cvs commit: jakarta-velocity-tools/src/java/org/apache/velocity/tools/generic RenderTool.java

nbubna      2004/11/10 12:17:17

  Modified:    src/java/org/apache/velocity/tools/generic RenderTool.java
  Log:
  fix BUG: 31583 - make RenderTool handle null VTL strings gracefully (thanks to Tim Colson for this)
  
  Revision  Changes    Path
  1.8       +6 -1      jakarta-velocity-tools/src/java/org/apache/velocity/tools/generic/RenderTool.java
  
  Index: RenderTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-tools/src/java/org/apache/velocity/tools/generic/RenderTool.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RenderTool.java	9 Jun 2004 01:30:58 -0000	1.7
  +++ RenderTool.java	10 Nov 2004 20:17:17 -0000	1.8
  @@ -95,6 +95,11 @@
        */
       public String eval(Context ctx, String vtl) throws Exception
       {
  +        /* don't waste time with null or empty strings */
  +        if (vtl == null || vtl.length() == 0)
  +        {
  +            return null;
  +        }
           StringWriter sw = new StringWriter();
           boolean success = Velocity.evaluate(ctx, sw, LOG_TAG, vtl);
           if (success)
  
  
  

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