garyp       01/08/09 10:13:15

  Modified:    java/src/org/apache/xml/dtm/ref/sax2dtm SAX2DTM.java
  Log:
  Fix for bugzilla 3060 
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3060).  Prefixes and
  namespaceURIs are kept in the same Vector, m_prefixMappings.  The entries are 
stored as pairs of vector elements.  The even elements contain the prefix and 
the odd elements contain the URI.  In two routines, getPrefix and endElement, 
the appropriate prefix or URI was being located in the Vector using an indexOf. 
 However, in this case where the prefix and the URI were the same, the routine 
was looking for the URI but finding the prefix instead of the URI.  It tried 
tried to back up one to get the prefix and underflowed the Vector size.
  
  Revision  Changes    Path
  1.15      +13 -3     
xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
  
  Index: SAX2DTM.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SAX2DTM.java      2001/07/28 00:25:59     1.14
  +++ SAX2DTM.java      2001/08/09 17:13:15     1.15
  @@ -1230,11 +1230,16 @@
     {
   
       String prefix;
  +    int uriIndex = -1;
   
       if (null != uri && uri.length() > 0)
       {
  -      int uriIndex = m_prefixMappings.indexOf(uri, 0);
   
  +      do
  +      {
  +        uriIndex = m_prefixMappings.indexOf(uri, ++uriIndex);
  +      } while ( (uriIndex & 0x01) == 0);
  +
         if (uriIndex >= 0)
         {
           prefix = (String) m_prefixMappings.elementAt(uriIndex - 1);
  @@ -1560,9 +1565,14 @@
   
       if(null == prefix)
         prefix = "";
  +
  +    int index = m_contextIndexes.peek() - 1;
  +
  +    do
  +    {
  +      index = m_prefixMappings.indexOf(prefix, ++index);
  +    } while ( (index >= 0) && ((index & 0x01) == 0x01) );
   
  -    int start = m_contextIndexes.peek();
  -    int index = m_prefixMappings.indexOf(prefix, start);
   
       if (index > -1)
       {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to