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: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
