freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Senkowski (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FREEMARKER-29) Stream closed Exception
Date Mon, 18 Jul 2016 13:12:20 GMT
Christian Senkowski created FREEMARKER-29:
---------------------------------------------

             Summary: Stream closed Exception
                 Key: FREEMARKER-29
                 URL: https://issues.apache.org/jira/browse/FREEMARKER-29
             Project: Apache Freemarker
          Issue Type: Bug
          Components: engine
    Affects Versions: 2.3.23
         Environment: Tomcat
            Reporter: Christian Senkowski


Hi,

I'm getting Stream closed -exceptions flooding my log since 2.3.23 when using <#include>

{quote}
freemarker.core._MiscTemplateException: [... Exception message was already printed; see it
above ...]
        at freemarker.core.Include.accept(Include.java:160)
        at freemarker.core.Environment.visit(Environment.java:324)
        at freemarker.core.Environment.process(Environment.java:302)
[…]
Caused by: java.io.IOException: Stream closed
        at java.io.StringReader.ensureOpen(StringReader.java:56)
        at java.io.StringReader.read(StringReader.java:90)
        at java.io.BufferedReader.read1(BufferedReader.java:210)
        at java.io.BufferedReader.read(BufferedReader.java:286)
        at freemarker.template.Template$LineTableBuilder.read(Template.java:701)
        at freemarker.core.SimpleCharStream.FillBuff(SimpleCharStream.java:107)
        at freemarker.core.SimpleCharStream.readChar(SimpleCharStream.java:188)
        at freemarker.core.SimpleCharStream.BeginToken(SimpleCharStream.java:129)
        at freemarker.core.FMParserTokenManager.getNextToken(FMParserTokenManager.java:7190)
        at freemarker.core.FMParser.jj_scan_token(FMParser.java:5131)
        at freemarker.core.FMParser.jj_3_16(FMParser.java:3812)
        at freemarker.core.FMParser.jj_2_16(FMParser.java:3549)
        at freemarker.core.FMParser.Root(FMParser.java:3427)
        at freemarker.template.Template.<init>(Template.java:208)
        at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:495)
        at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:409)
        at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:261)
        at freemarker.template.Configuration.getTemplate(Configuration.java:1786)
        at freemarker.core.Environment.getTemplateForInclusion(Environment.java:2044)
        at freemarker.core.Include.accept(Include.java:158)
        ... 31 more
{quote}

I am extending the Freemarker Config

{quote}
 public static class FreemarkerConfig extends Configuration {

        public FreemarkerConfig() {
            super(FREEMARKER_VERSION);
            setObjectWrapper(new DefaultObjectWrapper(FREEMARKER_VERSION));
            setCacheStorage(new FreemarkerCacheStorage());
            setTemplateExceptionHandler(new FreemarkerTemplateExceptionHandler());
            setTemplateUpdateDelayMilliseconds(Integer.MAX_VALUE);
            setOutputEncoding("utf-8");
            setLocalizedLookup(false);

            // create static stuff to access utility class in freemarker
            final BeansWrapper wrapper = new BeansWrapperBuilder(FREEMARKER_VERSION).build();
            TemplateHashModel staticModels = wrapper.getStaticModels();
            try {
                TemplateHashModel util = (TemplateHashModel) staticModels.get(Util.class.getName());
                setSharedVariable("util", util);
            } catch (final TemplateModelException e) {
                throw new IllegalStateException(e);
            }
        }
    }
{quote}

If you need any further informations please let me know. Any help highly appreciated. Chaning
everything back to 2.3.20 let's this exception disappear.

Thanks,
Diceme7



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message