You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Will Glass-Husain <wg...@gmail.com> on 2009/05/18 21:58:08 UTC

Macros occasionally not parsing

Hi,

I'm having problems with templates that are occasionally not parsing
macros.  The macro appears literally in the body of the result:

#somemacro($argument)

The error occurs under load in a webapp (e.g. when the same template
is being retrieved simultaneously).  I know it's not a template error
since the same template will work fine in one call and then not run
the macro in the next.

I seem to remember this was an issue with early versions of Velocity,
but I just upgraded to 1.6.2 and still see the problem.  Anyone else
see this issue?

WILL

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Macros occasionally not parsing

Posted by Nathan Bubna <nb...@gmail.com>.
Sorry, thought of a few more things to clarify...  When the problem
appears, you are actually seeing this in the output:

#Dataset($decision, $decision, "$GraphColorList.get(5)", "2")

Right?  And this happens when the same template is being retrieved in
multiple threads at the same time?  And has/is the template been/being
cached? I'm guessing no on the last one, but want to be sure.

On Mon, May 18, 2009 at 1:25 PM, Will Glass-Husain
<wg...@gmail.com> wrote:
> Thanks,
>
> The macro is defined in the template.  It looks like:
>
> #set($rounds = $currRound - 1)
> #macro(Dataset $decn $label $color $width)
>    <dataset seriesName="$label"
>                     color="$color"
>                         thickness="$width"
>                         anchorBorderColor="$color" >
>                #foreach($step in [0..$rounds])
>                        <set value='$Values.get("$decn").getResult($step)'/>
>                #end
>    </dataset>
> #end
>
> and the call like this:
>                #Dataset($decision, $decision, "$GraphColorList.get(5)", "2")
>
> My macro option are:
>        p.setProperty("velocimacro.library", "macro_library.fml");
>        p.setProperty("velocimacro.permissions.allow.inline.local.scope",
> "true");
>        p.setProperty("velocimacro.context.localscope", "true");
>
>
> Let me know if you see anything useful.  We originally had this
> problem under Velocity 1.5 so I upgraded to 1.6.2.   I'll set up a
> test case under load, see if I can replicate it.
>
> WILL
>
> On Mon, May 18, 2009 at 1:06 PM, Nathan Bubna <nb...@gmail.com> wrote:
>> I haven't seen this with 1.6.2, but none of my current projects are
>> under any load (yet).  Just to clarify, is the macro defined and used
>> in the template or just used in the template?  And for completeness,
>> what are your macro settings?
>>
>> On Mon, May 18, 2009 at 12:58 PM, Will Glass-Husain
>> <wg...@gmail.com> wrote:
>>> Hi,
>>>
>>> I'm having problems with templates that are occasionally not parsing
>>> macros.  The macro appears literally in the body of the result:
>>>
>>> #somemacro($argument)
>>>
>>> The error occurs under load in a webapp (e.g. when the same template
>>> is being retrieved simultaneously).  I know it's not a template error
>>> since the same template will work fine in one call and then not run
>>> the macro in the next.
>>>
>>> I seem to remember this was an issue with early versions of Velocity,
>>> but I just upgraded to 1.6.2 and still see the problem.  Anyone else
>>> see this issue?
>>>
>>> WILL
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Macros occasionally not parsing

Posted by Will Glass-Husain <wg...@gmail.com>.
Thanks,

The macro is defined in the template.  It looks like:

#set($rounds = $currRound - 1)
#macro(Dataset $decn $label $color $width)
    <dataset seriesName="$label"
		     color="$color"
			 thickness="$width"
			 anchorBorderColor="$color" >
		#foreach($step in [0..$rounds])
			<set value='$Values.get("$decn").getResult($step)'/>
		#end
    </dataset>
#end

and the call like this:
		#Dataset($decision, $decision, "$GraphColorList.get(5)", "2")

My macro option are:
        p.setProperty("velocimacro.library", "macro_library.fml");
        p.setProperty("velocimacro.permissions.allow.inline.local.scope",
"true");
        p.setProperty("velocimacro.context.localscope", "true");


Let me know if you see anything useful.  We originally had this
problem under Velocity 1.5 so I upgraded to 1.6.2.   I'll set up a
test case under load, see if I can replicate it.

WILL

On Mon, May 18, 2009 at 1:06 PM, Nathan Bubna <nb...@gmail.com> wrote:
> I haven't seen this with 1.6.2, but none of my current projects are
> under any load (yet).  Just to clarify, is the macro defined and used
> in the template or just used in the template?  And for completeness,
> what are your macro settings?
>
> On Mon, May 18, 2009 at 12:58 PM, Will Glass-Husain
> <wg...@gmail.com> wrote:
>> Hi,
>>
>> I'm having problems with templates that are occasionally not parsing
>> macros.  The macro appears literally in the body of the result:
>>
>> #somemacro($argument)
>>
>> The error occurs under load in a webapp (e.g. when the same template
>> is being retrieved simultaneously).  I know it's not a template error
>> since the same template will work fine in one call and then not run
>> the macro in the next.
>>
>> I seem to remember this was an issue with early versions of Velocity,
>> but I just upgraded to 1.6.2 and still see the problem.  Anyone else
>> see this issue?
>>
>> WILL
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Macros occasionally not parsing

Posted by Nathan Bubna <nb...@gmail.com>.
I haven't seen this with 1.6.2, but none of my current projects are
under any load (yet).  Just to clarify, is the macro defined and used
in the template or just used in the template?  And for completeness,
what are your macro settings?

On Mon, May 18, 2009 at 12:58 PM, Will Glass-Husain
<wg...@gmail.com> wrote:
> Hi,
>
> I'm having problems with templates that are occasionally not parsing
> macros.  The macro appears literally in the body of the result:
>
> #somemacro($argument)
>
> The error occurs under load in a webapp (e.g. when the same template
> is being retrieved simultaneously).  I know it's not a template error
> since the same template will work fine in one call and then not run
> the macro in the next.
>
> I seem to remember this was an issue with early versions of Velocity,
> but I just upgraded to 1.6.2 and still see the problem.  Anyone else
> see this issue?
>
> WILL
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org