-
Notifications
You must be signed in to change notification settings - Fork 234
Description
StringTemplate version: 4.3.1
I'm migrating a web application from Tomcat 7 to Tomcat 8. It appears something in the class loader behavior has changed between the versions.
My app calls STGroupDir group = new STGroupDir("com/example/app/path/to/templates");
When running on Tomcat 7, after the line root = cl.getResource(dirName); at STGroupDir.java:72 the variable root has the value
jar:file:/path/to/exploded/app/WEB-INF/lib/my-component.jar!/com/example/app/path/to/templates
Running on Tomcat 8, root has the value
jar:file:/path/to/exploded/app/WEB-INF/lib/my-component.jar!/com/example/app/path/to/templates/
My app then calls ST st = group.getInstanceOf("/TemplateGroup/someTemplate"); to load someTemplate from ...path/to/templates/TemplateGroup.stg.
When load() calculates groupFileURL on line STGroupDir.java:128, the value is
jar:file:/path/to/exploded/app/WEB-INF/lib/my-component.jar!/com/example/app/path/to/templates//TemplateName.stg
The double slash prevents it from successfully loading the template group file, and getInstanceOf() returns null.