Bug 13971 - Style tag does not work with Tomcat 4 with xml or xsl as BodyContent
Summary: Style tag does not work with Tomcat 4 with xml or xsl as BodyContent
Status: RESOLVED LATER
Alias: None
Product: Taglibs
Classification: Unclassified
Component: XTags Taglib (show other bugs)
Version: unspecified
Hardware: All All
: P3 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
: 17053 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-25 14:19 UTC by Teva Lautier
Modified: 2009-11-29 19:46 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Teva Lautier 2002-10-25 14:19:16 UTC
Because tomcat 4.1.12 use a tag pool, when you use style tag using xml or xsl 
inside body, it throw an exception once on two.
I know why and I know how to correct it :

    public int doAfterBody() throws JspException {
        if ( bodyContent != null ) {
            String text = bodyContent.getString().trim();
            if ( text.length() > 0 ) {
                if ( xsl == null ) {^
                   ^^^^^^^^^^^^^^^^^^
                    xsl = new StringReader( text );
                }
                else if ( xml == null ) {
                    ^^^^^^^^^^^^^^^^^^
                    xml = new StringReader( text );
                }
...
It test if xml or xsl is null, or because it use a pool, first time it access 
to xml in body, it create a StringReader, secund times, it did not create a 
new one (because xml is not null) and you will have an exception because this 
reader is closed.

To correct this bug, add destroying xml and xsl variable in doEndTag in 
finally section :

        finally {
            stringWriter = null;
            xml=null;
            xsl=null;
        }

Best,
Teva Lautier
Comment 1 Christopher Schultz 2002-12-18 16:15:04 UTC
It looks like this might be caused by Bug #13667.
Comment 2 Jozef Matula 2003-02-21 06:00:34 UTC
*** Bug 17053 has been marked as a duplicate of this bug. ***
Comment 3 Henri Yandell 2009-11-29 19:46:41 UTC
Resolving. Taglib has been retired.