You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2005/01/20 17:05:08 UTC

DO NOT REPLY [Bug 20034] - Invalid cache in InsertTag

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=20034


bas@neteffect.nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




------- Additional Comments From bas@neteffect.nl  2005-01-20 17:05 -------
Since according to the spec, there may be multiple invocations on doStartTag() 
and doEndTag() without release being called, the patch is not a 100% solution.

Using Orion releaseInternal() is not invoked from doEndTag() when an  
excepetion occurs processing the <tiles:include> nor is the release() method 
invoked when the same include is processed in a later request. Therefore the 
cached context is then used and the tag includes an old tile.

Using Tomcat the cached context is not reset either but Tomcat appears to not 
reuse the tag despite tag pooling is enabled and therefore the problem does not 
surface.

To work around the problem one can disable tag pooling (Orion: -
Djsp.reuse.tags=false, Tomcat: $TOMCAT_HOME/conf/web.xml --> 
enablePooling=false). 

To eliminate the problem one can make sure resetInternal() is called from 
doEndTag() regardless whether an exception occured but I am not sure this is 
the best solution:

public int doEndTag() throws JspException {
  if (!processEndTag) {
     releaseInternal();
     return EVAL_PAGE;
  }

  int res = 0;
  try {
      res = tagHandler.doEndTag();
    }
  finally {
      // Reset properties used by object, in order to be able to reuse object.
      releaseInternal();
  }

  return res;
}

I used Orion 2.0.5, Tomcat 4.1.31 and Struts 1.2.4 with the following 
application to study this: 

Two action mappings forward to two tiles-definitions. Each definition uses a 
different jsp for attribute "mytile". Both definitions extend a definition 
which uses layout.jsp. The layout contains <tiles:insert name="mytile"/> to 
insert one of the two jsp's. One jsp deliberately causes a null pointer 
exception. The other diplays some text. 

When I first browse to the mapping which inserts the jsp which causes the 
exception and then browse to the other mapping, the <tiles:insert> inserts the 
jsp from the first request.

NOTE: This also occurs if the code itself does not cause exceptions; under 
Orion a HttpIOException occurs when the browser cancels the current request, 
for instance when the refresh button is hit. If the exception occurs before or 
during the processing of an insert tag the tag cache will not be reset and 
subsequent request will use the invalid cache value. 



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org