geirm       01/03/06 11:26:25

  Modified:    src/java/org/apache/velocity/runtime Runtime.java
  Log:
  Tiny fix for small bug noticed by David Esposito <[EMAIL PROTECTED]>
  
  Simply protects the other Runtime.init() methods to prevent the properties
  from being set twice - the Configuration class converts scalar values
  to vector values if the same property is set twice.
  
  This can happen if you call init( filename ) or init( Properties ) more
  than once - ex, a mult-servlet webapp when the servlet is based on
  the VelocityServlet base class.
  
  It's also good to protect ourselves this way from any application type.
  
  This will fix it for any servlet user until Jason gets the Configuration
  fixed (he knows about it...)
  
  Revision  Changes    Path
  1.92      +11 -5     
jakarta-velocity/src/java/org/apache/velocity/runtime/Runtime.java
  
  Index: Runtime.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/Runtime.java,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- Runtime.java      2001/03/05 11:45:08     1.91
  +++ Runtime.java      2001/03/06 19:26:24     1.92
  @@ -172,7 +172,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Jeff Bowden</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magusson Jr.</a>
  - * @version $Id: Runtime.java,v 1.91 2001/03/05 11:45:08 jvanzyl Exp $
  + * @version $Id: Runtime.java,v 1.92 2001/03/06 19:26:24 geirm Exp $
    */
   public class Runtime implements RuntimeConstants
   {    
  @@ -297,8 +297,11 @@
       public synchronized static void init( Properties props )
           throws Exception
       {
  -        overridingProperties = props;
  -        init();
  +        if( initialized == false )
  +        {
  +            overridingProperties = props;
  +            init();
  +        }
       }
   
       /**
  @@ -311,8 +314,11 @@
       public synchronized static void init( String props )
           throws Exception
       {
  -        setProperties(props);
  -        init();
  +        if (initialized == false)
  +        {
  +            setProperties(props);
  +            init();
  +        }
       }
   
       /**
  
  
  

Reply via email to