velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lamb, Doug" <>
Subject RE: Velocity exits foreach loop in macro unpredictably, both 1.1 and 1.2-dev
Date Mon, 05 Nov 2001 17:00:35 GMT
Maybe I'm way off here, but it doesn't sound like Velocity is the problem to
me.  I would be suspicious of the getStoredData() method in the event
object.  I would try and isolate this by making getStoredData() simply
return a literal String and see if the problem goes away.

Just a thought,


-----Original Message-----
From: Nick Bauman []
Sent: Monday, November 05, 2001 9:25 AM
Subject: Velocity exits foreach loop in macro unpredictably, both 1.1
and 1.2-dev

Forgive me my inability to come up with a consise example of how to
reproduce the error, if I had one I probably could have fixed it myself. I
can't force this to reproduce itself except under our load testing
environment at my company. I'm now working to consisely reproduce the
problem in another contrived situation. I'm asking the community if anything
 I'm showing "rings a bell" to a problem.

We use Velocity as a mail templating system. We recently discovered that in
thousands of requests over a period of 5 minutes, the resulting merge()
calls yield mysteriously incomplete emails. No exceptions are thrown,
everything appears fine in the logs. 

Our typical template looks like this:


#* $Id: Texten_msftrxbx.vtl,v 1.1 2001/11/05 15:06:40 hvanlaar Exp $ *#
#parse ( "functions.vtl" )


Thank you for using Acme Center. Below is a copy of your chat session
transcript for reference.

Topic: $!meeting.getTopic()

#drawStandardTextTranscript( $meeting )



the parsed template, entitled "functions.vtl" looks like this:


...[other stuff]...

#macro( drawStandardTextTranscript $meeting )
#foreach( $event in $meeting.getAllEvents() )
#set( $yapper = $meeting.getParticipation($event.getFromId()) )
#if( $event.getClass().getName().equals($urlEvent) )
$yapper.getName(): $event.getStoredData()
#elseif( $event.getClass().getName().equals($chatEvent) )
#if($repRole.equals($yapper.getRole()) )
#set( $repId = $yapper.getParticipantId() )
$yapper.getName(): $event.getStoredData()

...[other stuff]...


The problem is the resulting output ocassionally (5-25% of the time) will
not contain all $event.getStoredData() that it should. However, all the
other stuff in the template will look fine: the footer and everything else.
So, for some of the mails, there should be 15 lines of text, but we only see
one or two. It's very strange and I cannot reproduce it outside of our load

Question is: is it possible some wierd threading behavior is ocurring? I'm
not reusing a new VelocityContext for each call to merge() I'm making a new
one each time. All other settings in Velocity are default except the
template root, which I define.

Thanks for any insights.

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message