dlr         02/04/03 08:36:00

  Modified:    src/java/org/apache/velocity/servlet VelocityServlet.java
  Log:
  Added logging of initialization properties deprecation warning to the
  loadConfiguration(ServletConfig) implementation.
  
  Revision  Changes    Path
  1.46      +15 -11    
jakarta-velocity/src/java/org/apache/velocity/servlet/VelocityServlet.java
  
  Index: VelocityServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/servlet/VelocityServlet.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -u -r1.45 -r1.46
  --- VelocityServlet.java      3 Apr 2002 16:07:33 -0000       1.45
  +++ VelocityServlet.java      3 Apr 2002 16:36:00 -0000       1.46
  @@ -68,6 +68,7 @@
   import java.util.Properties;
   
   import javax.servlet.ServletConfig;
  +import javax.servlet.ServletContext;
   import javax.servlet.ServletException;
   import javax.servlet.ServletOutputStream;
   
  @@ -128,7 +129,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
    * @author <a href="[EMAIL PROTECTED]">Kent Johnson</a>
    * @author <a href="[EMAIL PROTECTED]">Daniel Rall</a>
  - * $Id: VelocityServlet.java,v 1.45 2002/04/03 16:07:33 dlr Exp $
  + * $Id: VelocityServlet.java,v 1.46 2002/04/03 16:36:00 dlr Exp $
    */
   public abstract class VelocityServlet extends HttpServlet
   {
  @@ -295,7 +296,7 @@
        *  @throws FileNotFoundException if a specified file is not found.
        *  @throws IOException I/O problem accessing the specified file, if specified.
        */
  -    protected Properties loadConfiguration(ServletConfig config )
  +    protected Properties loadConfiguration(ServletConfig config)
           throws IOException, FileNotFoundException
       {
           // This is a little overly complex because of legacy support
  @@ -305,24 +306,27 @@
           String propsFile = config.getInitParameter(INIT_PROPS_KEY);
           if (propsFile == null || propsFile.length() == 0)
           {
  +            ServletContext sc = config.getServletContext();
               propsFile = config.getInitParameter(OLD_INIT_PROPS_KEY);
               if (propsFile == null || propsFile.length() == 0)
               {
  -                propsFile = config.getServletContext()
  -                    .getInitParameter(INIT_PROPS_KEY);
  +                propsFile = sc.getInitParameter(INIT_PROPS_KEY);
                   if (propsFile == null || propsFile.length() == 0)
                   {
  -                    propsFile = config.getServletContext()
  -                        .getInitParameter(OLD_INIT_PROPS_KEY);
  -                }
  -                else
  -                {
  -                    // TODO: Log deprecation warning.
  +                    propsFile = sc.getInitParameter(OLD_INIT_PROPS_KEY);
  +                    if (propsFile != null && propsFile.length() > 0)
  +                    {
  +                        sc.log("Use of the properties initialization " +
  +                               "parameter '" + OLD_INIT_PROPS_KEY + "' has " +
  +                               "been deprecated by '" + INIT_PROPS_KEY + '\'');
  +                    }
                   }
               }
               else
               {
  -                // TODO: Log deprecation warning.
  +                sc.log("Use of the properties initialization parameter '" +
  +                       OLD_INIT_PROPS_KEY + "' has been deprecated by '" +
  +                       INIT_PROPS_KEY + '\'');
               }
           }
           
  
  
  

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

Reply via email to