geirm       01/03/16 22:15:36

  Modified:    examples/app_example2 Example2.java
  Log:
  Added try/catch for init() and mergeTemplate() - recent changes to
  o.a.v.a.Velocity
  
  Revision  Changes    Path
  1.2       +19 -3     jakarta-velocity/examples/app_example2/Example2.java
  
  Index: Example2.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/examples/app_example2/Example2.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Example2.java     2001/02/12 03:10:06     1.1
  +++ Example2.java     2001/03/17 06:15:36     1.2
  @@ -66,7 +66,7 @@
    *
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
  - * @version $Id: Example2.java,v 1.1 2001/02/12 03:10:06 geirm Exp $
  + * @version $Id: Example2.java,v 1.2 2001/03/17 06:15:36 geirm Exp $
    */
   
   public class Example2
  @@ -75,7 +75,15 @@
       {
           /* first, we init the runtime engine.  Defaults are fine. */
           
  -        Velocity.init();
  +        try
  +        {
  +            Velocity.init();
  +        }
  +        catch(Exception e)
  +        {
  +            System.out.println("Problem initializing Velocity : " + e );
  +            return;
  +        }
   
           /* lets make a Context and put data into it */
   
  @@ -88,7 +96,15 @@
   
           StringWriter w = new StringWriter();
   
  -        Velocity.mergeTemplate("example2.vm", context, w );
  +        try
  +        {
  +            Velocity.mergeTemplate("example2.vm", context, w );
  +        }
  +        catch (Exception e )
  +        {
  +            System.out.println("Problem merging template : " + e );
  +        }
  +
           System.out.println(" template : " + w );
   
           /* 
  
  
  

Reply via email to