[ 
https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986068#action_12986068
 ] 

Becky Cartine commented on VELOCITY-795:
----------------------------------------

Here is code that I used to reproduce the error.
I apologize for the misleading issue subject - I do not presume to know the 
cause of the problem.
Perhaps there are some other dependencies that are required?
I am running this code with the following: commons-collections-3.1.jar, 
velocity-1.7.jar, commons-lang-2.6.jar



            Velocity.init();
            String filename = "test.template";
            
            InputStream in = 
Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);

            BufferedReader reader = new BufferedReader(new 
InputStreamReader(in));
            StringBuffer buf = new StringBuffer();
            String line = null;
            while ((line = reader.readLine()) != null) {
                buf.append(line);
            }

            String message = buf.toString().trim();
            System.out.println(message);
            
            Map values = new HashMap();
            
            VelocityContext ctx = new VelocityContext(values);
            StringWriter out = new StringWriter();
            Velocity.evaluate(ctx,out,"Test",message);

            out.flush();
            System.out.println( out.toString() );


> Multiple #if statements causes ParseErrorException: Encountered "<EOF>" 
> ------------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>         Environment: Mac OSX, Java 1.5, Velocity 1.4
>            Reporter: Becky Cartine
>
> When I include an #if statement twice in a velocity template, I get a 
> ParseErrorException.
> If I remove the first occurance of the #if statement below, there are no 
> errors.
> <html>
> <body>
> some text here
> #if ($message)
>  Message:
> #end
> some more text
> #if ($message)
>   Message:
> #end
> </body>
> </html>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to