velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Townson, Chris" <>
Subject macros and comments between 1.4 and 1.5
Date Tue, 03 Apr 2007 15:35:50 GMT

Moving from velocity engine 1.4 to 1.5, one of my macros is now causing a ParseException:

#macro( makeLink $filepath )#*

    *##if ($request.serverName.equalsIgnoreCase("") || $request.serverName.equalsIgnoreCase(""))#*

        *##set($mirrorDomain = "")#*


        *##set($mirrorDomain = "")#*

    *##elseif($request.serverName.equalsIgnoreCase("") || $request.serverName.equalsIgnoreCase("localhost"))#*

        *##set($mirrorDomain = "")#*


        *##set($mirrorDomain = "")#*




This macro uses the mutli-line comment hack to gobble whitespace (so that none appears in
the link text, whilst preserving some kind of readability.

This works fine in 1.4, but throws a ParseException in 1.5 (stacktrace below)

Is this known or expected beahviour? (I had a browse through jira and the wiki, but couldn't
see anything which would seem to identify this problem).



-- stacktrace --

2007-04-03 16:05:38,712 - VelocimacroManager.parseTree() : exception makeLink
org.apache.velocity.runtime.parser.ParseException: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError:
Lexical error at line 1, column 535.  Encountered: <EOF> after : ""
	at org.apache.velocity.runtime.parser.Parser.parse(
	at org.apache.velocity.runtime.RuntimeInstance.parse(
	at org.apache.velocity.runtime.directive.VelocimacroProxy.parseTree(
	at org.apache.velocity.runtime.directive.VelocimacroProxy.setupMacro(
	at org.apache.velocity.runtime.directive.VelocimacroProxy.init(
	at org.apache.velocity.runtime.parser.node.ASTDirective.init(
	at org.apache.velocity.runtime.parser.node.SimpleNode.init(
	at org.apache.velocity.Template.initDocument(
	at org.apache.velocity.Template.process(
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(
	at org.apache.velocity.runtime.RuntimeInstance.getTemplate(
	at org.apache.velocity.runtime.RuntimeInstance.getTemplate(
	at javax.servlet.http.HttpServlet.service(
	at javax.servlet.http.HttpServlet.service(
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(
	at org.apache.catalina.core.StandardWrapperValve.invoke(
	at org.apache.catalina.core.StandardContextValve.invoke(
	at org.apache.catalina.core.StandardHostValve.invoke(
	at org.apache.catalina.valves.ErrorReportValve.invoke(
	at org.apache.catalina.core.StandardEngineValve.invoke(
	at org.apache.catalina.connector.CoyoteAdapter.service(
	at org.apache.coyote.http11.Http11Processor.process(
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(
	at org.apache.tomcat.util.threads.ThreadPool$

DISCLAIMER: This e-mail is confidential and should not be used by anyone who is
not the original intended recipient. If you have received this e-mail in error
please inform the sender and delete it from your mailbox or any other storage
mechanism. Neither Macmillan Publishers Limited nor any of its agents accept
liability for any statements made which are clearly the sender's own and not
expressly made on behalf of Macmillan Publishers Limited or one of its agents.
Please note that neither Macmillan Publishers Limited nor any of its agents
accept any responsibility for viruses that may be contained in this e-mail or
its attachments and it is your responsibility to scan the e-mail and 
attachments (if any). No contracts may be concluded on behalf of Macmillan 
Publishers Limited or its agents by means of e-mail communication. Macmillan 
Publishers Limited Registered in England and Wales with registered number 785998 
Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS   
View raw message