DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20577>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20577 FormatterToXML - assert() failed if buffering disabled Summary: FormatterToXML - assert() failed if buffering disabled Product: XalanC Version: 1.5 Platform: All OS/Version: Other Status: NEW Severity: Minor Priority: Other Component: XalanC AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] following assertion failed if buffering == false (last FormatterToXML constructor param fBufferData), cuz m_charbuf is resized to a size >0 only if buffering is used. XMLSupport/FormatterToXML.cpp (line 890): void FormatterToXML::flushChars() { assert(m_charBuf.size() > 0 && m_charBuf.size() >= m_pos); m_writer->write(&m_charBuf[0], 0, m_pos); m_pos = 0; } sample: #include <xercesc/util/PlatformUtils.hpp> #include <Include/PlatformDefinitions.hpp> #include <PlatformSupport/XalanOutputStreamPrintWriter.hpp> #include <PlatformSupport/XalanStdOutputStream.hpp> #include <PlatformSupport/AttributeListImpl.hpp> #include <XMLSupport/FormatterToXML.hpp> #include <iostream> XALAN_USING_XALAN(XalanOutputStreamPrintWriter) XALAN_USING_XALAN(XalanStdOutputStream) XALAN_USING_XALAN(FormatterToXML) XALAN_USING_XALAN(XalanDOMString) XALAN_USING_XALAN(AttributeListImpl) XALAN_USING_XERCES(XMLPlatformUtils) int main() { try { XMLPlatformUtils::Initialize(); { XalanStdOutputStream theStream (std::cout); XalanOutputStreamPrintWriter theWriter(theStream); FormatterToXML theFormatter(theWriter, XalanDOMString(), false, FormatterToXML::eDefaultIndentAmount, XalanDOMString(), XalanDOMString(), XalanDOMString(), XalanDOMString(), true, XalanDOMString(), FormatterToXML::OUTPUT_METHOD_XML, false /* buffering disabled */); AttributeListImpl theAttributes; theFormatter.setShouldWriteXMLHeader(true); theFormatter.startDocument(); theFormatter.startElement(XALAN_STATIC_UCODE_STRING ("assert"), theAttributes); theFormatter.endElement(XALAN_STATIC_UCODE_STRING ("assert")); theFormatter.endDocument(); /* asserts */ } XMLPlatformUtils::Terminate(); return 0; } catch(...) { return 1; } }
