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=25897>. 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=25897 SchemaGrammar::getElemDecl(elemid) throws Exception if ElemDecl not found instead of doing a GroupElemDecl lookup Summary: SchemaGrammar::getElemDecl(elemid) throws Exception if ElemDecl not found instead of doing a GroupElemDecl lookup Product: Xerces-C++ Version: 2.4.0 Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Validating Parser (Schema) (Xerces 1.5 or up only) AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] validators/schema/SchemaGrammar.hpp (line 654): inline const XMLElementDecl* SchemaGrammar::getElemDecl(const unsigned int elemId) const { // Look up this element decl by id const SchemaElementDecl* decl = fElemDeclPool->getById(elemId); if (!decl) decl = fGroupElemDeclPool->getById(elemId); return decl; } utils/RefHash3KeysIdPool.c (line 314): template <class TVal> TVal* RefHash3KeysIdPool<TVal>::getById(const unsigned int elemId) { // If its either zero or beyond our current id, its an error if (!elemId || (elemId > fIdCounter)) ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_InvalidId, fMemoryManager); return fIdPtrs[elemId]; } the getElemDecl() code tries to find the ElemDecl by Id in the ElemDecl Pool. the !decl check introduces a GroupElemDecl lookup if the first lookup failed, but the group lookup never gets executed, because fElemDeclPool is a RefHash3KeysIdPool and RefHash3KeysIdPool::getById() throws an IllegalArgumentException if the Id is not found, instead of returning a zero- pointer. fix: inline const XMLElementDecl* SchemaGrammar::getElemDecl(const unsigned int elemId) { const SchemaElementDecl* decl = 0; // Look up this element decl by id try { decl = fElemDeclPool->getById(elemId); } catch(const IllegalArgumentException&) { decl = fGroupElemDeclPool->getById(elemId); } return decl; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]