You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Olaf Klischat (JIRA)" <de...@velocity.apache.org> on 2010/09/23 15:01:42 UTC

[jira] Created: (VELOCITY-777) ParseErrorException line-/columnNumber properties not set

ParseErrorException line-/columnNumber properties not set
---------------------------------------------------------

                 Key: VELOCITY-777
                 URL: https://issues.apache.org/jira/browse/VELOCITY-777
             Project: Velocity
          Issue Type: Bug
          Components: Engine
    Affects Versions: 1.6.4
         Environment: Velocity 1.6.4
            Reporter: Olaf Klischat


import java.io.StringReader;
import java.io.StringWriter;

import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.exception.ParseErrorException;


public class VelErrTest {

    public static void main(String[] args) throws Exception {
        String template = "hello\n\nFoo bar #blah(foo.bar.baz)";
        VelocityContext ctx = new VelocityContext();
        StringWriter out = new StringWriter(100);
        try {
            Velocity.evaluate(ctx, out, "test", new StringReader(template));
            System.out.println(out.toString());
        } catch (ParseErrorException pex) {
            System.out.println("ParseErrorException: "+ pex.getMessage());
            System.out.println(" ..at: " + pex.getLineNumber() + ", " + pex.getColumnNumber());
        }
    }

}



...outputs:

ParseErrorException: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 3, column 19.  Encountered: "b" (98), after : "."
 ..at: -1, -1

i.e. the getLineNumber(), getColumnNumber() fields are (-1,-1) rather than (3,19).


-- 
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-777) ParseErrorException line-/columnNumber properties not set

Posted by "Misagh Moayyed (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12926550#action_12926550 ] 

Misagh Moayyed commented on VELOCITY-777:
-----------------------------------------

I cant duplicate the problem, and the output is as you would expect it. I ran the code inside a small unit test and here's the output line:

ParseErrorException: Lexical error,   Encountered: "b" (98), after : "." at *unset*[line 3, column 19]
 ..at: 3, 19

> ParseErrorException line-/columnNumber properties not set
> ---------------------------------------------------------
>
>                 Key: VELOCITY-777
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-777
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6.4
>         Environment: Velocity 1.6.4
>            Reporter: Olaf Klischat
>
> import java.io.StringReader;
> import java.io.StringWriter;
> import org.apache.velocity.VelocityContext;
> import org.apache.velocity.app.Velocity;
> import org.apache.velocity.exception.ParseErrorException;
> public class VelErrTest {
>     public static void main(String[] args) throws Exception {
>         String template = "hello\n\nFoo bar #blah(foo.bar.baz)";
>         VelocityContext ctx = new VelocityContext();
>         StringWriter out = new StringWriter(100);
>         try {
>             Velocity.evaluate(ctx, out, "test", new StringReader(template));
>             System.out.println(out.toString());
>         } catch (ParseErrorException pex) {
>             System.out.println("ParseErrorException: "+ pex.getMessage());
>             System.out.println(" ..at: " + pex.getLineNumber() + ", " + pex.getColumnNumber());
>         }
>     }
> }
> ...outputs:
> ParseErrorException: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 3, column 19.  Encountered: "b" (98), after : "."
>  ..at: -1, -1
> i.e. the getLineNumber(), getColumnNumber() fields are (-1,-1) rather than (3,19).

-- 
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