You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by bu...@apache.org on 2002/10/25 16:19:18 UTC

DO NOT REPLY [Bug 13971] New: - Style tag does not work with Tomcat 4 with xml or xsl as BodyContent

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13971>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=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
           Product: Taglibs
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: XTags Taglib
        AssignedTo: taglibs-dev@jakarta.apache.org
        ReportedBy: teva.lautier@temis-group.com


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

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>