geirm       01/02/02 03:57:57

  Modified:    whiteboard/geir Velocity.java
  Log:
  Update with suggestions from Thomas Fahrmeyer
  
  Revision  Changes    Path
  1.2       +9 -7      jakarta-velocity/whiteboard/geir/Velocity.java
  
  Index: Velocity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/whiteboard/geir/Velocity.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Velocity.java     2001/02/01 18:50:15     1.1
  +++ Velocity.java     2001/02/02 11:57:56     1.2
  @@ -65,7 +65,7 @@
    * SLOW PROGRESS :)
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
  - * @version $Id: Velocity.java,v 1.1 2001/02/01 18:50:15 geirm Exp $
  + * @version $Id: Velocity.java,v 1.2 2001/02/02 11:57:56 geirm Exp $
    */
   
   package org.apache.velocity.util;
  @@ -163,31 +163,33 @@
        *
        */
   
  -    public static  boolean evaluate( Context c,  Writer out, String s)
  +    public static  boolean evaluate( Context context,  Writer out, String logTag, 
String instring )
       {
  -        ByteArrayInputStream inStream = new ByteArrayInputStream( s.getBytes() );
  -        return evaluate( c, out, inStream );
  +        ByteArrayInputStream inStream = new ByteArrayInputStream( 
instring.getBytes() );
  +        return evaluate( context, out, logTag, inStream );
       }
   
  -    public static boolean evaluate( Context context, Writer writer, InputStream 
instream )
  +    public static boolean evaluate( Context context, Writer writer, String logTag, 
InputStream instream )
       {
           SimpleNode nodeTree = null;
   
           try
           {
  -            nodeTree = Runtime.parse( instream, "<app eval>" );        
  +            nodeTree = Runtime.parse( instream, logTag );        
    
               if (nodeTree != null)
               {
                   InternalContextAdapterImpl ica = new InternalContextAdapterImpl( 
context );
  -                ica.setCurrentTemplateName( "<app eval>" );
  +                ica.setCurrentTemplateName( logTag );
                   nodeTree.init( ica, null );
                   nodeTree.render( ica, writer );
                   return true;
               }
           }
           catch( Exception e )
  -            {}
  +        {
  +            Runtime.error("Velocity.evaluate() : tag = " + logTag + " : " + e );
  +        }
   
           return false;
       }
  
  
  

Reply via email to