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 bu...@apache.org on 2001/09/26 08:45:32 UTC
DO NOT REPLY [Bug 3831] New: -
Attributes::getValue(XMLCh *qName) throws undocumented exception
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=3831>.
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=3831
Attributes::getValue(XMLCh *qName) throws undocumented exception
Summary: Attributes::getValue(XMLCh *qName) throws undocumented
exception
Product: Xerces-C++
Version: 1.4
Platform: Sun
OS/Version: Solaris
Status: NEW
Severity: Normal
Priority: Other
Component: SAX/SAX2
AssignedTo: xerces-c-dev@xml.apache.org
ReportedBy: buk@de.ibm.com
We have discovered a problem in xml4c in following sample code:
Attributes myAttr;
XMLCh *myXMLCh;
myXMLCh = myAttr.getValue("somethingnonexisting");
You get an error like:
An exception occured! Type: ArrayIndexOutofBoundsException, Message: The index
given was beyond the may attribute index.
When we look into the xml4c 3.5 code (src\internal\VecAttributesImpl.cpp),
getValue should return NULL, but it could not work.
getValue(XMLCh *qName) {
return getValue(getIndex(qName));
}
getIndex returns in this case -1, and getValue(-1) checked whether the argument
is greater than the array length, but not whether it is smaller. getValue is
defined as getValue(unsigned int). These leads to an error for -1.
Tested on SUN Solaris 2.6 with SUN Workshop 4.2 and XML4C 3.3 (perhaps it also
will happen on XML4C 3.5), we will try to test with XML4C 3.5, but this will
take a while.
On Windows 2000, XML4C 3.5 and MSVC 6.0 no problem.
Same problem if you change in SAX2Count sample in SAX2CountHandlers.cpp the
startElement(...) method to:
void SAX2CountHandlers::startElement(const XMLCh* const uri
, const XMLCh* const localname
, const XMLCh* const qname
, const Attributes& attrs)
{
XMLCh *somethingNotExisting = XMLString::transcode("SomethingNotExisting");
const XMLCh *myCh = attrs.getValue(somethingNotExisting);
fElementCount++;
fAttrCount += attrs.getLength();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org