You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@apache.org on 2001/07/30 13:05:12 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime VelocimacroFactory.java

geirm       01/07/30 04:05:12

  Modified:    src/java/org/apache/velocity/runtime VelocimacroFactory.java
  Log:
  Suggestion by Tal Dayan <ta...@zapta.com> to quiet log output when user
  specifies null or empty name for VM library.
  
  Revision  Changes    Path
  1.13      +21 -14    jakarta-velocity/src/java/org/apache/velocity/runtime/VelocimacroFactory.java
  
  Index: VelocimacroFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/VelocimacroFactory.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- VelocimacroFactory.java	2001/03/20 01:11:15	1.12
  +++ VelocimacroFactory.java	2001/07/30 11:05:12	1.13
  @@ -67,7 +67,7 @@
    *   manages the set of VMs in a running Velocity engine.
    *
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - * @version $Id: VelocimacroFactory.java,v 1.12 2001/03/20 01:11:15 jon Exp $ 
  + * @version $Id: VelocimacroFactory.java,v 1.13 2001/07/30 11:05:12 geirm Exp $ 
    */
   public class VelocimacroFactory
   {
  @@ -129,20 +129,27 @@
                    {
                        String lib = (String) v.elementAt(i);
                    
  -                     try 
  -                     {
  -                         logVMMessageInfo("Velocimacro : adding VMs from " +
  -                                          "VM library template : " + lib  );
  -                    
  -                         Template template = Runtime.getTemplate( lib );   
  -                         
  -                         logVMMessageInfo("Velocimacro :  VM library template " +
  -                                          "macro registration complete." );
  -                     } 
  -                     catch (Exception e)
  +                     /*
  +                      * only if it's a non-empty string do we bother
  +                      */
  +
  +                     if (lib != null && !lib.equals(""))
                        {
  -                         logVMMessageInfo("Velocimacro : error using  VM " +
  -                                          "library template " + lib + " : " + e );
  +                         try 
  +                         {
  +                             logVMMessageInfo("Velocimacro : adding VMs from " +
  +                                              "VM library template : " + lib  );
  +                             
  +                             Template template = Runtime.getTemplate( lib );   
  +                             
  +                             logVMMessageInfo("Velocimacro :  VM library template " +
  +                                              "macro registration complete." );
  +                         } 
  +                         catch (Exception e)
  +                         {
  +                             logVMMessageInfo("Velocimacro : error using  VM " +
  +                                              "library template " + lib + " : " + e );
  +                         }
                        }
                    }
                }