You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Doug Carter <dc...@mercycorps.org> on 2011/04/29 17:08:09 UTC

Debugging templates that have #include or #parse

Hi all,

I have this problem on rare occasions, but I've never found a way
to resolve it...

Say I have a template named "template.vm" that has something like:

<html>
<head>
<title>Page Name</title>
</head>
<body>
#parse ( "macros.vm" )
#parse ( "navbar.inc" )

#set ( $foo = "some val")
.
.
.

I'll find some velocity error in the logs, like:

Velocity [error] Error in evaluation of == expression. Both arguments
must be of the same Class. Currently left = class java.lang.String,
right = class java.lang.Long. /template.vm [line 10, column 42]

The error is indicating line 10 in the /template.vm file, but the error
is actually in one of the #parsed files, so locating the error can be
difficult at times.

Is there a way to expand the template so that it shows all of the velocity
code un-parsed? As I recall long ago, C had a way to show the contents of
a .c file that would expand macros and show the contents of include files.


TIA,

Doug





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


Re: Debugging templates that have #include or #parse

Posted by Nathan Bubna <nb...@gmail.com>.
Yeah, Doug, version 1.4 definitely had issues with this sort of
debugging output in the logs.  Hope you can upgrade...

On Mon, May 2, 2011 at 11:42 AM, Doug Carter <dc...@mercycorps.org> wrote:
>
> Hi Nathan,
>
> On Fri, Apr 29, 2011 at 11:23:11AM -0700, Nathan Bubna wrote:
>> On Fri, Apr 29, 2011 at 8:08 AM, Doug Carter <dc...@mercycorps.org> wrote:
>> >
>> > Hi all,
>> >
>> > I have this problem on rare occasions, but I've never found a way
>> > to resolve it...
>> >
>> > Say I have a template named "template.vm" that has something like:
>> >
>> > <html>
>> > <head>
>> > <title>Page Name</title>
>> > </head>
>> > <body>
>> > #parse ( "macros.vm" )
>> > #parse ( "navbar.inc" )
>> >
>> > #set ( $foo = "some val")
>> > .
>> > .
>> > .
>> >
>> > I'll find some velocity error in the logs, like:
>> >
>> > Velocity [error] Error in evaluation of == expression. Both arguments
>> > must be of the same Class. Currently left = class java.lang.String,
>> > right = class java.lang.Long. /template.vm [line 10, column 42]
>> >
>> > The error is indicating line 10 in the /template.vm file, but the error
>> > is actually in one of the #parsed files, so locating the error can be
>> > difficult at times.
>>
>> The error in the logs should have the proper template name, line and
>> column.  If not, that is a bug.  What version of Velocity are you
>> using?  We have had bugs like that in the past, but i thought they
>> were fixed.
>
> I'm embarrassed to say that I'm still running an older version, 1.4. I'll
> be upgrading soon, so I'll do some more complete testing and see if I
> can duplicate this problem before posting again.
>
>> > Is there a way to expand the template so that it shows all of the velocity
>> > code un-parsed? As I recall long ago, C had a way to show the contents of
>> > a .c file that would expand macros and show the contents of include files.
>>
>> No, Velocity has no support for that.
>
> Thanks for the info.
>
>
> Best,
>
> Doug
>
>
>
> ---------------------------------------------------------------------
> 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: Debugging templates that have #include or #parse

Posted by Doug Carter <dc...@mercycorps.org>.
Hi Nathan,

On Fri, Apr 29, 2011 at 11:23:11AM -0700, Nathan Bubna wrote:
> On Fri, Apr 29, 2011 at 8:08 AM, Doug Carter <dc...@mercycorps.org> wrote:
> >
> > Hi all,
> >
> > I have this problem on rare occasions, but I've never found a way
> > to resolve it...
> >
> > Say I have a template named "template.vm" that has something like:
> >
> > <html>
> > <head>
> > <title>Page Name</title>
> > </head>
> > <body>
> > #parse ( "macros.vm" )
> > #parse ( "navbar.inc" )
> >
> > #set ( $foo = "some val")
> > .
> > .
> > .
> >
> > I'll find some velocity error in the logs, like:
> >
> > Velocity [error] Error in evaluation of == expression. Both arguments
> > must be of the same Class. Currently left = class java.lang.String,
> > right = class java.lang.Long. /template.vm [line 10, column 42]
> >
> > The error is indicating line 10 in the /template.vm file, but the error
> > is actually in one of the #parsed files, so locating the error can be
> > difficult at times.
> 
> The error in the logs should have the proper template name, line and
> column.  If not, that is a bug.  What version of Velocity are you
> using?  We have had bugs like that in the past, but i thought they
> were fixed.

I'm embarrassed to say that I'm still running an older version, 1.4. I'll
be upgrading soon, so I'll do some more complete testing and see if I
can duplicate this problem before posting again.

> > Is there a way to expand the template so that it shows all of the velocity
> > code un-parsed? As I recall long ago, C had a way to show the contents of
> > a .c file that would expand macros and show the contents of include files.
> 
> No, Velocity has no support for that.

Thanks for the info.


Best,

Doug



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


Re: Debugging templates that have #include or #parse

Posted by Nathan Bubna <nb...@gmail.com>.
On Fri, Apr 29, 2011 at 8:08 AM, Doug Carter <dc...@mercycorps.org> wrote:
>
> Hi all,
>
> I have this problem on rare occasions, but I've never found a way
> to resolve it...
>
> Say I have a template named "template.vm" that has something like:
>
> <html>
> <head>
> <title>Page Name</title>
> </head>
> <body>
> #parse ( "macros.vm" )
> #parse ( "navbar.inc" )
>
> #set ( $foo = "some val")
> .
> .
> .
>
> I'll find some velocity error in the logs, like:
>
> Velocity [error] Error in evaluation of == expression. Both arguments
> must be of the same Class. Currently left = class java.lang.String,
> right = class java.lang.Long. /template.vm [line 10, column 42]
>
> The error is indicating line 10 in the /template.vm file, but the error
> is actually in one of the #parsed files, so locating the error can be
> difficult at times.

The error in the logs should have the proper template name, line and
column.  If not, that is a bug.  What version of Velocity are you
using?  We have had bugs like that in the past, but i thought they
were fixed.

> Is there a way to expand the template so that it shows all of the velocity
> code un-parsed? As I recall long ago, C had a way to show the contents of
> a .c file that would expand macros and show the contents of include files.

No, Velocity has no support for that.

>
> TIA,
>
> Doug
>
>
>
>
>
> ---------------------------------------------------------------------
> 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