mmidy 01/10/18 13:30:44
Modified: java/src/org/apache/xalan/templates ElemApplyTemplates.java
ElemCallTemplate.java
Log:
Bugzilla 4218: Make sure that the stack frame gets restored to the frame that
was previously set. Just calling unlink() may restore to the wrong frame, and
get us out of synch.
Revision Changes Path
1.17 +5 -5
xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java
Index: ElemApplyTemplates.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ElemApplyTemplates.java 2001/06/26 18:59:59 1.16
+++ ElemApplyTemplates.java 2001/10/18 20:30:44 1.17
@@ -253,7 +253,8 @@
DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt,
sourceNode);
VariableStack vars = xctxt.getVarStack();
int nParams = getParamElemCount();
-
+ int thisframe = vars.getStackFrame();
+
try
{
@@ -299,7 +300,6 @@
// This code will create a section on the stack that is all the
// evaluated arguments. These will be copied into the real params
// section of each called template.
- int thisframe = vars.getStackFrame();
argsFrame = vars.link(nParams);
vars.setStackFrame(thisframe);
@@ -313,7 +313,6 @@
vars.setStackFrame(argsFrame);
}
-
int child;
while (DTM.NULL != (child = sourceNodes.nextNode()))
{
@@ -440,9 +439,10 @@
transformer.getTraceManager().fireSelectedEndEvent(sourceNode, this,
"select", new XPath(m_selectExpression),
new org.apache.xpath.objects.XNodeSet(sourceNodes));
-
+
+ // Unlink to the original stack frame
if(nParams > 0)
- vars.unlink();
+ vars.unlink(thisframe);
xctxt.popSAXLocator();
xctxt.popContextNodeList();
transformer.popElemTemplateElement();
1.19 +10 -1
xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java
Index: ElemCallTemplate.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ElemCallTemplate.java 2001/06/12 19:15:07 1.18
+++ ElemCallTemplate.java 2001/10/18 20:30:44 1.19
@@ -282,7 +282,16 @@
{
transformer.popElemTemplateElement();
xctxt.setSAXLocator(savedLocator);
- vars.unlink();
+ // When we entered this function, the current
+ // frame buffer (cfb) index in the variable stack may
+ // have been manually set. If we just call
+ // unlink(), however, it will restore the cfb to the
+ // previous link index from the link stack, rather than
+ // the manually set cfb. So,
+ // the only safe solution is to restore it back
+ // to the same position it was on entry, since we're
+ // really not working in a stack context here. (Bug4218)
+ vars.unlink(thisframe);
}
}
else
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]