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=21087>.
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=21087

Bug in ExpandedNameTable.java hashing algorithm

           Summary: Bug in ExpandedNameTable.java hashing algorithm
           Product: XalanJ2
           Version: CurrentCVS
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xml.dtm
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When method getExpandedTypeID is adding a new entry to the hash table, and the 
hash table needs to be expanded, the 'index' is calculated before the table is 
rehashed and is not recalculated after the table expansion and rehash. This 
results in the entry going to the wrong place in the table. A subsequent call 
to getExpandedTypeId fails to find the entry and adds a new one. The end result 
is that elements are not found when an XPATH expression tries to find them by 
name. The fix is to add a recalculation of the index immediately after the call 
to rehash as shown:-

// Expand the internal HashEntry array if necessary.
if (m_nextType > m_threshold)
{
   rehash();
   index = hash % m_capacity;
   if (index < 0)
      index = -index;
}

Reply via email to