Return-Path: Delivered-To: apmail-xml-xalan-dev-archive@www.apache.org Received: (qmail 98733 invoked from network); 12 Dec 2006 02:24:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2006 02:24:45 -0000 Received: (qmail 45368 invoked by uid 500); 12 Dec 2006 02:24:52 -0000 Delivered-To: apmail-xml-xalan-dev-archive@xml.apache.org Received: (qmail 45346 invoked by uid 500); 12 Dec 2006 02:24:52 -0000 Mailing-List: contact xalan-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: xalan-dev@xml.apache.org List-Id: Delivered-To: mailing list xalan-dev@xml.apache.org Received: (qmail 45335 invoked by uid 99); 12 Dec 2006 02:24:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Dec 2006 18:24:52 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Dec 2006 18:24:43 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id BF2A3714168 for ; Mon, 11 Dec 2006 18:24:23 -0800 (PST) Message-ID: <2544263.1165890263780.JavaMail.jira@brutus> Date: Mon, 11 Dec 2006 18:24:23 -0800 (PST) From: "Brian Minchau (JIRA)" To: xalan-dev@xml.apache.org Subject: [jira] Assigned: (XALANJ-2349) Serializer's ElemContext does not properly initialize a field sometimes. In-Reply-To: <21131389.1164843862442.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ 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: xalan-dev-unsubscribe@xml.apache.org For additional commands, e-mail: xalan-dev-help@xml.apache.org