[ http://issues.apache.org/jira/browse/XALANJ-2349?page=all ]
Brian Minchau reassigned XALANJ-2349:
-------------------------------------
Assignee: Brian Minchau
Assiging to Brian Minchau, who agreed to look at this one at
the Xalan-J JIRA triage on December 11, 2006
> Serializer's ElemContext does not properly initialize a field sometimes.
> ------------------------------------------------------------------------
>
> Key: XALANJ-2349
> URL: http://issues.apache.org/jira/browse/XALANJ-2349
> Project: XalanJ2
> Issue Type: Bug
> Reporter: Brian Minchau
> Assigned To: Brian Minchau
> Fix For: The Latest Development Code
>
> Attachments: xalanj-2349.patch.txt
>
>
> The serializer's ElemContext class has a push(uri,localName,qName) method.
> Such a push occurs whenever
> a startElement() is called and we use such an object to collect information
> about the element. Its fields are:
> 1. m_currentElemDepth
> 2. m_elemDesc
> 3. m_elementLocalName
> 4. m_elementName
> 5. m_elementURI
> 6. m_isCdataSection
> 7. m_isRaw
> 8. m_next
> 9. m_prev
> 10. m_startTagOpen
> The stack of such ElemContext objects is doubly linked with fields 8. and 9.
> and these are OK.
> When an pop() occurs the ElemContext object doesn't really go away, just the
> "high water mark" is changed
> and next time we go to push() we can re-use the ElemContext object.
> Looking into ElemContext push() ... these fields are always set:
> 3. 4. 5. 6. 10.
> There is a remark that m_isRaw (field 7.) is already set in the HTML
> startElement() so this field is OK
> The questionable fields left are 1. and 2. Field 1. is set in the
> ElemContext constructor. If the object is re-used it will be re-used ad the
> same depth. So the bug is that field 2. m_elemDesc is not reset to null if
> a ElemContext is re-used.
> The code currently is:
> ElemContext frame = this.m_next;
> if (frame == null)
> {
> /* We have never been at this depth yet, and there is no
> * stack frame to re-use, so we now make a new one.
> */
> frame = new ElemContext(this);
> this.m_next = frame;
> }
> // Initialize, or reset values in the new or re-used stack frame.
> frame.m_elementName = qName;
> frame.m_elementLocalName = localName;
> frame.m_elementURI = uri;
> frame.m_isCdataSection = false;
> .... but should be:
> ElemContext frame = this.m_next;
> if (frame == null)
> {
> /* We have never been at this depth yet, and there is no
> * stack frame to re-use, so we now make a new one.
> */
> frame = new ElemContext(this);
> this.m_next = frame;
> } else {
> frame.m_isCdataSection = false;
> frame.m_elementDesc = null;
> }
>
> // Initialize, or reset values in the new or re-used stack frame.
> frame.m_elementName = qName;
> frame.m_elementLocalName = localName;
> frame.m_elementURI = uri;
>
> .... note that this change sets m_elemDesc to null when the stack frame is
> re-used, and for performance reasons
> m_isCdataSection is only set to null when the frame is re-used (a new frame
> has it false when it is constructed)
> The bug will manifest itself when the output is HTML and we have two child
> elements (siblings) with say different
> features about their escaping, or whether they are "empty" or not, and the
> features of the first element will
> carry over to the seconde one.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]