Update of /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib
In directory james.mmbase.org:/tmp/cvs-serv32555

Modified Files:
      Tag: MMBase-1_8
        ContextTag.java 
Log Message:
MMB-1730


See also: 
http://cvs.mmbase.org/viewcvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib
See also: http://www.mmbase.org/jira/browse/MMB-1730


Index: ContextTag.java
===================================================================
RCS file: 
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/ContextTag.java,v
retrieving revision 1.87
retrieving revision 1.87.2.1
diff -u -b -r1.87 -r1.87.2.1
--- ContextTag.java     17 Jul 2006 15:38:47 -0000      1.87
+++ ContextTag.java     7 Oct 2008 10:39:26 -0000       1.87.2.1
@@ -43,7 +43,7 @@
  * </p>
  *
  * @author Michiel Meeuwissen
- * @version $Id: ContextTag.java,v 1.87 2006/07/17 15:38:47 johannes Exp $
+ * @version $Id: ContextTag.java,v 1.87.2.1 2008/10/07 10:39:26 michiel Exp $
  * @see ImportTag
  * @see WriteTag
  */
@@ -56,13 +56,13 @@
     public static final String DEFAULTENCODING_KEY   = 
"org.mmbase.taglib.defaultencoding";
     public static final String ISELIGNORED_PARAM     = 
"mmbase.taglib.isELIgnored";
 
-    private ContextProvider  parent = null;
     private boolean    searchedParent = false;
     private static int  latestNumber = 0;
 
     private int number;
 
     private CloudContext cloudContext;
+    private ContextContainer prevParent;
 
     private Attribute referid = Attribute.NULL;
     private Attribute scope   = Attribute.NULL;
@@ -131,11 +131,11 @@
 
     public int doStartTag() throws JspTagException {
         log.debug("Start tag of ContextTag");
-        parent = null;
         searchedParent = false;
 
         ContextContainer container;
         int s = getScope();
+        prevParent = null;
         if (referid != Attribute.NULL || (s != PageContext.PAGE_SCOPE && 
getId() != null)) {
             Object o;
             if (s == PageContext.PAGE_SCOPE) {
@@ -152,9 +152,11 @@
                 container = 
createContainer(getContextProvider().getContextContainer());
             } else {
                 if (! (o instanceof ContextContainer)) {
-                    throw new JspTagException("Found context var '" + o + "' 
is not of type Context but of '" + o.getClass().getName());
+                    throw new JspTagException("Found context var '" + o + "' 
is not of type ContextContainer but of '" + o.getClass().getName());
                 }
                 container = (ContextContainer)  o;
+                log.debug("Resetting parent of " + container + " to " + 
getContextProvider().getContextContainer());
+                prevParent = container.getParent();
                 container.setParent(pageContext, 
getContextProvider().getContextContainer());
                 pageContext.setAttribute(CONTAINER_KEY_PREFIX + number, 
container, PageContext.PAGE_SCOPE);
             }
@@ -318,7 +320,6 @@
         if (log.isDebugEnabled()) {
             log.debug("after body of context " + getId());
         }
-        getContextContainer().release(pageContext, 
getContextProvider().getContextContainer()); // remove the vars from 
'page-context' again if necessary.
         // just to serve lousy app-server which do not support 
EVAL_BODY_INCLUDE
         if (EVAL_BODY == EVAL_BODY_BUFFERED) {
             try {
@@ -333,14 +334,15 @@
     }
 
     public int doEndTag() throws JspTagException {
-        parent = null;
+        getContextContainer().release(pageContext, prevParent != null ? 
prevParent : getContextProvider().getContextContainer()); // remove the vars 
from 'page-context' again if necessary.
+        prevParent = null;
         cloudContext = null;
         return super.doEndTag();
     }
 
     public void doFinally() {
-        parent = null;
         cloudContext = null;
+        prevParent = null;
         super.doFinally();
     }
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to