You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Rocky Raccoon <rr...@bigfoot.com> on 2000/04/28 21:24:19 UTC
Bug in XML Reader ???
Hi,
If you create an XML File (a simple text file, not UTF-16) &
in the PI put the encoding as "UTF-16", a SAXParseException is thrown
Warning at (file D:\businessDTDs\tp.xml, line 1, char 44): Encoding
(UTF-16, from XMLDecl or manually set) contradicts the auto-sensed
encoding,
ignoring it which is fine, but later on the parser crashes.
This did not happen with the earlier versions of Xerces, but only with
the current version.
Any idea how to fix this.
When XMLReader::setEncoding("UTF-16") is called
it does a delete fEncodingStr; fEncodingStr = 0;
after which it detects the error [ that the file isn't actually UTF-16]
then the following code is executed
if (!fTranscoder)
{
if (fEncoding == XMLRecognizer::EBCDIC)
ThrowXML(RuntimeException,
XML4CExcepts::Reader_EncodingStrRequired);
// Ask the transcoding service to make use a transcoder
XMLTransService::Codes failReason;
fTranscoder =
XMLPlatformUtils::fgTransService->makeNewTranscoderFor
(fEncodingStr, failReason, kCharBufSize);
Here fEncodingStr is 0. Somewhere inside XMLString::copyNString is
called
which dereferences the null pointer & the app crashes.
In the old versions, this wasn't happening because the setEncoding
function
did not try to create a new Transcoder + there wasn't any copyNString
method at all.
Any workarounds ?
Re: Bug in XML Reader ???
Posted by Dean Roddey <dr...@charmedquark.com>.
That code doesn't really exist anymore, so I'm not sure what's going on
there. All of that code has been reworked to make it far more consistent.
You might want to try the most recent code. If its working there, then
perhaps the IBM crew might consider it fixed. I'm not sure if they'd do a
'dot' release to fix it in an older version or not.
--------------------------
Dean Roddey
The CIDLib Class Libraries
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com
"Give me immortality, or give me death"