If I use "acquisition", I can not load templates from
external jar-files with the ClassTemplateLoader. If I
read templates from my own sourcecode, it works.
I tracked the problem down. The Bug lies in
freemarker.cache.TemplateCache.concatPath(). Every path
ends with "/" (Behind the template name). This seems to
work with normal ClassLoaders but not if the template
has to be read from a jar-file.
The following source code
Template t = cfg.getTemplate("standard/*/README.txt");
makes the following debug output:
2006-01-21 19:30:48,704 DEBUG [freemarker.cache] -
<Could not find template in cache, creating new one;
id=[standard/*/README.txt[de_DE,ISO-8859-15,parsed] ]>
2006-01-21 19:30:48,710 DEBUG [freemarker.cache] -
<Trying to find template source standard/README_de_DE.txt/>
2006-01-21 19:30:48,715 DEBUG [freemarker.cache] -
<Trying to find template source README_de_DE.txt/>
2006-01-21 19:30:48,717 DEBUG [freemarker.cache] -
<Trying to find template source standard/README_de.txt/>
2006-01-21 19:30:48,719 DEBUG [freemarker.cache] -
<Trying to find template source README_de.txt/>
2006-01-21 19:30:48,721 DEBUG [freemarker.cache] -
<Trying to find template source standard/README.txt/>
2006-01-21 19:30:48,723 DEBUG [freemarker.cache] -
<Trying to find template source README.txt/>
Thanks for making this great program!
Thomas Bayen
Logged In: YES
user_id=33187
This does look like a bug. Acquisition should work the same
way whether you load from the actual file system or the
virtual file system inside a .jar file. I have, for the
moment, assigned this to Attila Szegedi, who wrote the code
in question.
Logged In: NO
The problem is caused by TemplateCache.concatPath() which
always appends a '/' to each element.
TemplateCache.acquireTemplateSource() should probably strip
the last '/' off.
Logged In: YES
user_id=52489
This is now fixed in SVN trunk. Please indicate in at most 14
days if the fix works for you so we can close the bug. If you don
't reply within 14 days, the SourceForge will automatically
switch the bug state to "Deleted".
Logged In: YES
user_id=52489
Logged In: YES
user_id=33187
Again, I guess we need the patch applied in the 2.3 bugfixes
branch in CVS.
Logged In: YES
user_id=546667
Do NOT use the SVN trunk! That contains an instable
developement version of FM 2.4 or 3.0, not 2.3.x.
Instead, please test this prebuilt fixed version (contains
several other bugfixes as well), which is a 2.3.7 predecessor:
http://freemarker.sourceforge.net/hotfix/freemarker.jar
Logged In: YES
user_id=1312539
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).