Velocity cannot handle relative paths in included (#parse) files.
-----------------------------------------------------------------
Key: VELOCITY-539
URL: https://issues.apache.org/jira/browse/VELOCITY-539
Project: Velocity
Issue Type: Bug
Components: Engine
Affects Versions: 1.5
Environment: Linux rj 2.6.16-rc6 #1 SMP PREEMPT Thu Mar 16 13:52:44
CET 2006 i686 Intel(R) Pentium(R) 4 CPU 3.20GHz GenuineIntel GNU/Linux
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)
-
Reporter: Robbert-Jan Roos
Priority: Minor
situation:
/tmp/template.vtl: #parse("dir/tmpl2.vtl")
/tmp/dir/tmpl2.vtl: #parse("tmpl3.vtl")
/tmp/dir/tmp;3.vtl: "Hello world!"
code:
public class Test {
public static void main(String[] args) throws Exception {
Properties p = new Properties();
p.setProperty("file.resource.loader.path", "/tmp");
Velocity.init(p);
StringWriter out = new StringWriter();
Velocity.mergeTemplate("template.vtl", "UTF-8", new
VelocityContext(), out);
System.out.println(out.getBuffer().toString());
}
}
result:
Exception in thread "main"
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource 'template3.vtl'
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:452)
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:335)
at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1102)
at org.apache.velocity.runtime.directive.Parse.render(Parse.java:177)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.Template.merge(Template.java:254)
at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:483)
at nl.basenet.apps.rj.Test.main(Test.java:16)
--
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]