On Tue, 7 Aug 2012 23:26:53 +0530
Dishara Wijewardana <ddwijeward...@gmail.com> wrote:

> 
> I think I got you ;-). I have commited the fix which sets and gets
> the file name as a context attribute. And if we are doing so we have
> to recommend users to provide the file name of the template (which is
> on classpath) when providing the script itself.
> 
> I also got the point of caching and will commit when the fix is ready
> and tests passed.
> 

You are right, if we're not given the script filename, we cannot do any
caching. Please forget this for now and come back to what you had -what
I had in mind was not to use geTemplate(), but to use a specific
Velocity resource loader.

I looked at your VelocityScriptEngine implementation, and I have some
remarks:

 - you can factorize eval(String,ScriptContext) and
   eval(Reader,ScriptContext) with a StringReader.

 - when an exception is thrown, its stack trace should be displayed on
   the stream returned by scriptContext.getErrorWriter()

 - when scriptContext.getWriter() is null, the default writer shoud be
   System.out (right now, the output is lost...).

 - "return new ScriptException(exp)" should be:
    throw new ScriptException(exp)

That's all I see for now.

  Claude

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to