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: [email protected]
For additional commands, e-mail: [email protected]