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/15 21:47:30 UTC

DO NOT REPLY [Bug 13667] New: - super.release() not called in release() methods

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=13667>.
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=13667

super.release() not called in release() methods

           Summary: super.release() not called in release() methods
           Product: Taglibs
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: DBTags Taglib
        AssignedTo: taglibs-dev@jakarta.apache.org
        ReportedBy: lorenh@firepond.com


Almost every tag forgets to call super.release() In their release() method.  
This doesn't cause any problems if your container doesn't recycle tags.  But if 
you are using Tomcat 4.1.x and have multiple instances of the tags on the same 
page, the page buffer from the previous instance can be reused in the second in 
some situations.

  public void release() {
    super.release();  <--- this needs to be added
    _position = -1;
    _attributeName = null;
    _name = null;
    _scope = "page";
    _tag = null;
    _metaData = null;
    _locale = null;
  }

For more detailed info see the posts I made to the taglib user list starting 
here:
http://www.mail-archive.com/taglibs-user%40jakarta.apache.org/msg03439.html

If we have two statements on the same page, where the first one returns
rows, but the second does not, the second statement tag prints out the
actual text of it's query instead of nothing.

For example:
  <sql:statement id="stmt2" conn="conn">
    <sql:query>select * from foo/*a query that returns rows*/</sql:query>
    <sql:resultSet id="rset2">
    </sql:resultSet>
  </sql:statement>

  <sql:statement id="stmt3" conn="conn">
    <sql:query>select * from bar /*a query that returns NO
rows*/</sql:query>
    <sql:resultSet id="rset3">
    </sql:resultSet>
  </sql:statement>
Would actually send back to the browser

  "select * from bar /*a query that returns NO rows*/"

In the following example, the second resultSet outputs all of the items from the
_first_ query.

------------First Query returns rows-----------
<%  java.sql.Statement stmt2 = conn.createStatement();
    java.sql.ResultSet rset2 = stmt2.executeQuery("SELECT * FROM foo");
    pageContext.setAttribute("rset2", rset2); 
%>
    <sql:resultSet id="rset2b" name="rset2" scope="page">
        <sql:getColumn colName="IndexedID"/>
    </sql:resultSet>
<%  rset2.close();
    stmt2.close();
%>
----------Second Query returns NO rows-----------
<%  java.sql.Statement stmt3 = conn.createStatement();
    java.sql.ResultSet rset3 = stmt3.executeQuery("SELECT * FROM bar);
    pageContext.setAttribute("rset3", rset3);
%>
    <sql:resultSet id="rset3b" name="rset3" scope="page">
        <sql:getColumn colName="IndexedID"/>  <--- BUG BUG outputs all items
from first query!!
    </sql:resultSet>
<%  rset3.close();
    stmt3.close();
%>

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