You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Becky Cartine (JIRA)" <de...@velocity.apache.org> on 2011/01/24 21:34:44 UTC

[jira] Created: (VELOCITY-795) Multiple #if statements causes ParseErrorException: Encountered ""

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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-795) Velocity.evaluate String - ParseErrorException: Encountered ""

Posted by "Becky Cartine (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986616#action_12986616 ] 

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

The attached zip files contains two VTL  templates for testing.
Here are the tags listed in the stacktrace.

Was expecting one of:
    "(" ...
    <RPAREN> ...
    <ESCAPE_DIRECTIVE> ...
    <SET_DIRECTIVE> ...
    "##" ...
    "\\\\" ...
    "\\" ...
    <TEXT> ...
    "*#" ...
    "*#" ...
    "]]#" ...
    <STRING_LITERAL> ...
    <END> ...
    <IF_DIRECTIVE> ...
    <ELSEIF_DIRECTIVE> ...
    <ELSE_DIRECTIVE> ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <WORD> ...
    <BRACKETED_WORD> ...
    <IDENTIFIER> ...
    <DOT> ...
    "{" ...
    "}" ...
    <EMPTY_INDEX> ...
    

> Velocity.evaluate String - ParseErrorException: Encountered "<EOF>" 
> --------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Mac OSX, Java 1.5, Velocity 1.7
>            Reporter: Becky Cartine
>         Attachments: test-velocity.zip
>
>
> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Closed: (VELOCITY-795) Velocity.evaluate String - ParseErrorException: Encountered ""

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna closed VELOCITY-795.
---------------------------------


> Velocity.evaluate String - ParseErrorException: Encountered "<EOF>" 
> --------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Mac OSX, Java 1.5, Velocity 1.7
>            Reporter: Becky Cartine
>         Attachments: test-velocity.zip
>
>
> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Updated: (VELOCITY-795) Velocity.evaluate String - ParseErrorException: Encountered ""

Posted by "Becky Cartine (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Becky Cartine updated VELOCITY-795:
-----------------------------------

    Attachment: test-velocity.zip

contains source code and required jar files

> Velocity.evaluate String - ParseErrorException: Encountered "<EOF>" 
> --------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Mac OSX, Java 1.5, Velocity 1.7
>            Reporter: Becky Cartine
>         Attachments: test-velocity.zip
>
>
> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Closed: (VELOCITY-795) Multiple #if statements causes ParseErrorException: Encountered ""

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna closed VELOCITY-795.
---------------------------------


> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-795) Multiple #if statements causes ParseErrorException: Encountered ""

Posted by "Becky Cartine (JIRA)" <de...@velocity.apache.org>.
    [ 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-795) Velocity.evaluate String - ParseErrorException: Encountered ""

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986470#action_12986470 ] 

Nathan Bubna commented on VELOCITY-795:
---------------------------------------

I've been running it as a String this whole time, though with \n at the end of lines.   I just tried it without the \n's (so it's all on one line, like your code would have it) and it still worked fine for me.   Can you attach a zip of your little VelocityTest application, jars and all, to make sure one of us isn't just miscopying some of the text?

> Velocity.evaluate String - ParseErrorException: Encountered "<EOF>" 
> --------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Mac OSX, Java 1.5, Velocity 1.7
>            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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-795) Multiple #if statements causes ParseErrorException: Encountered ""

Posted by "Becky Cartine (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986382#action_12986382 ] 

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

I have further discovered that the code works if I call the method with the 'reader' object instead of the String 'message'

Velocity.evaluate(Context context, Writer writer, String logTag,Reader reader)

instead of

Velocity.evaluate(Context context, Writer writer, String logTag,String inString)

Here is the full stacktrace.

SEVERE: Parser Exception: Test
org.apache.velocity.runtime.parser.ParseException: Encountered "<EOF>" at line 1, column 396.
Was expecting one of:
 ( omitting list of tags )
...
	at org.apache.velocity.runtime.parser.Parser.generateParseException(Parser.java:3679)
	at org.apache.velocity.runtime.parser.Parser.jj_consume_token(Parser.java:3558)
	at org.apache.velocity.runtime.parser.Parser.IfStatement(Parser.java:1740)
	at org.apache.velocity.runtime.parser.Parser.Statement(Parser.java:352)
	at org.apache.velocity.runtime.parser.Parser.process(Parser.java:317)
	at org.apache.velocity.runtime.parser.Parser.parse(Parser.java:117)
	at org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1226)
	at org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1181)
	at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1297)
	at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1265)
	at org.apache.velocity.app.Velocity.evaluate(Velocity.java:180)
	at VelocityTest.main(VelocityTest.java:35)



> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-795) Velocity.evaluate String - ParseErrorException: Encountered ""

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986478#action_12986478 ] 

Nathan Bubna commented on VELOCITY-795:
---------------------------------------

Oh, and it would be useful to see the list of tags you omitted from that stack.  I'm fairly sure the IfStatement in the Parser code is upset about seeing an EOF before an #end, but i may as well be sure it's not looking for a ')' or something.

> Velocity.evaluate String - ParseErrorException: Encountered "<EOF>" 
> --------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Mac OSX, Java 1.5, Velocity 1.7
>            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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Issue Comment Edited: (VELOCITY-795) Velocity.evaluate String - ParseErrorException: Encountered ""

Posted by "Becky Cartine (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986616#action_12986616 ] 

Becky Cartine edited comment on VELOCITY-795 at 1/25/11 2:07 PM:
-----------------------------------------------------------------

The attached zip files contains two VTL  templates for testing.
Note:  the apache-commons jar files are the ones that came with the velocity download
Here are the tags listed in the stacktrace.

Was expecting one of:
    "(" ...
    <RPAREN> ...
    <ESCAPE_DIRECTIVE> ...
    <SET_DIRECTIVE> ...
    "##" ...
    "\\\\" ...
    "\\" ...
    <TEXT> ...
    "*#" ...
    "*#" ...
    "]]#" ...
    <STRING_LITERAL> ...
    <END> ...
    <IF_DIRECTIVE> ...
    <ELSEIF_DIRECTIVE> ...
    <ELSE_DIRECTIVE> ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <WORD> ...
    <BRACKETED_WORD> ...
    <IDENTIFIER> ...
    <DOT> ...
    "{" ...
    "}" ...
    <EMPTY_INDEX> ...
    

      was (Author: bcartine):
    The attached zip files contains two VTL  templates for testing.
Here are the tags listed in the stacktrace.

Was expecting one of:
    "(" ...
    <RPAREN> ...
    <ESCAPE_DIRECTIVE> ...
    <SET_DIRECTIVE> ...
    "##" ...
    "\\\\" ...
    "\\" ...
    <TEXT> ...
    "*#" ...
    "*#" ...
    "]]#" ...
    <STRING_LITERAL> ...
    <END> ...
    <IF_DIRECTIVE> ...
    <ELSEIF_DIRECTIVE> ...
    <ELSE_DIRECTIVE> ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <WORD> ...
    <BRACKETED_WORD> ...
    <IDENTIFIER> ...
    <DOT> ...
    "{" ...
    "}" ...
    <EMPTY_INDEX> ...
    
  
> Velocity.evaluate String - ParseErrorException: Encountered "<EOF>" 
> --------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Mac OSX, Java 1.5, Velocity 1.7
>            Reporter: Becky Cartine
>         Attachments: test-velocity.zip
>
>
> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-795) Multiple #if statements causes ParseErrorException: Encountered ""

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986081#action_12986081 ] 

Nathan Bubna commented on VELOCITY-795:
---------------------------------------

That code is functionally equivalent to mine, which does still parse the template fine.  Anyway, posting your runner code can sometimes be helpful for figuring out your problem, but a failing testcase that i can drop into the project testsuite or a running application from which a working testcase can be created are needed for confirming bug reports.

At this point (having been twice unable to replicate the problem), it probably would have been better to start this conversation on the user mailing list, but it seems nearly pointless to move it there now.

Can you please post the Velocity portion of the ParseErrorException's stack trace?

> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Updated: (VELOCITY-795) Passing String to Velocity.evaluate() causes ParseErrorException: Encountered ""

Posted by "Becky Cartine (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Becky Cartine updated VELOCITY-795:
-----------------------------------

          Environment: Mac OSX, Java 1.5, Velocity 1.7  (was: Mac OSX, Java 1.5, Velocity 1.4)
    Affects Version/s: 1.7
              Summary: Passing String to Velocity.evaluate() causes ParseErrorException: Encountered "<EOF>"   (was: Multiple #if statements causes ParseErrorException: Encountered "<EOF>" )

> Passing String to Velocity.evaluate() causes ParseErrorException: Encountered "<EOF>" 
> --------------------------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Mac OSX, Java 1.5, Velocity 1.7
>            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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Reopened: (VELOCITY-795) Multiple #if statements causes ParseErrorException: Encountered ""

Posted by "Becky Cartine (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Becky Cartine reopened VELOCITY-795:
------------------------------------


I upgraded to Velocity 1.7 and still get the ParseErrorException.  Here is the template:

<html>
<body>

The attached ZIP file is for the following filing:
<br/>
<br/>
Trust: ${owner.displayName} 
<br/>
Filing Date: ${filing.filingDate}
<br/>
#if ($submitDate)
  Receipt Date: ${submitDate}
  <br/>
#end
Filed by: ${filing.filer.displayName}
<br/>
Form: ${filing.submissionType}
<br/>
Effective Date: ${effectivenessDateOfReport}
<br/>
<br/>
#if ($message)
  Message:
  <p>
  ${message}
  </p>
#end

</body>
</html>

> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Resolved: (VELOCITY-795) Multiple #if statements causes ParseErrorException: Encountered ""

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna resolved VELOCITY-795.
-----------------------------------

    Resolution: Invalid

Velocity 1.4 is no longer receiving fixes.  Please upgrade to a modern version.  If you cannot upgrade, please consult the mailing list at user@velocity.apache.org for help in figuring out the cause of the error and fixes/workarounds that you are able to use.

> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Resolved: (VELOCITY-795) Velocity.evaluate String - ParseErrorException: Encountered ""

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna resolved VELOCITY-795.
-----------------------------------

    Resolution: Not A Problem

Thanks, that worked.  I should have figured this out quicker...  The problem is that you are eating the newlines out, and your template contains the sequence:  "#end\n\nsome".  Once the \n are gone, you get #endsome, which does not end the #if.   Use formal notation #{end}, and it works fine.

> Velocity.evaluate String - ParseErrorException: Encountered "<EOF>" 
> --------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Mac OSX, Java 1.5, Velocity 1.7
>            Reporter: Becky Cartine
>         Attachments: test-velocity.zip
>
>
> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Updated: (VELOCITY-795) Velocity.evaluate String - ParseErrorException: Encountered ""

Posted by "Becky Cartine (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Becky Cartine updated VELOCITY-795:
-----------------------------------

    Summary: Velocity.evaluate String - ParseErrorException: Encountered "<EOF>"   (was: Passing String to Velocity.evaluate() causes ParseErrorException: Encountered "<EOF>" )

> Velocity.evaluate String - ParseErrorException: Encountered "<EOF>" 
> --------------------------------------------------------------------
>
>                 Key: VELOCITY-795
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-795
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Mac OSX, Java 1.5, Velocity 1.7
>            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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-795) Multiple #if statements causes ParseErrorException: Encountered ""

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986042#action_12986042 ] 

Nathan Bubna commented on VELOCITY-795:
---------------------------------------

That template parses fine for me.   If you are sure this is a bug and not a problem with your own use of Velocity, then can you submit a failing testcase or runnable example app to demonstrate it?  That template alone was not sufficient for me to replicate the problem, since it works fine for me.   If you think this may be a problem with your template(s) rather than Velocity itself, please take the question to the user@velocity.apache.org list.   Then we can help you there where the problem and solution will be more easily discoverable for future users with the same problem.

If it helps you to decide which way to pursue, it is generally recommended that people take problems like this to the mailing list first, as that forum is larger.  Then, if it is clear that the problem is a bug in Velocity itself, it can be moved to the issue tracker.

Also, it is extremely unlikely that two #if statements is the cause of the problem, as that is an extremely common occurence, even in our own internal cases.  Best to withhold conclusions about the root issue until it's confirmed by a 2nd party.

> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org