You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Pavani Mukthipudi <Pa...@Sun.COM> on 2001/09/07 06:58:42 UTC

patch for bug# 2195 Xerces2: XMLAttributesImpl::removeElementAt corrupts list


Please find the attached patch for bug# 2195 (fix given by Glenn Marcy).

Pavani

-- 

Pavani Mukthipudi
Sun Microsystems Inc.

Phone: 080 - 2298989   Extn: 87390

Re: patch for bug# 2195 Xerces2: XMLAttributesImpl::removeElementAt corrupts list

Posted by Maulik Thakkar <xm...@yahoo.com>.
--- Pavani Mukthipudi <Pa...@Sun.COM>
wrote:
> 
> 
> Please find the attached patch for bug# 2195 (fix
> given by Glenn Marcy).
> 
> Pavani
> 
> -- 
> 
> Pavani Mukthipudi
> Sun Microsystems Inc.
> 
> Phone: 080 - 2298989   Extn: 87390
> > Index: XMLAttributesImpl.java
>
===================================================================
> RCS file:
>
/home/cvspublic/xml-xerces/java/src/org/apache/xerces/util/XMLAttributesImpl.java,v
> retrieving revision 1.2
> diff -u -r1.2 XMLAttributesImpl.java
> --- XMLAttributesImpl.java	2001/08/23 00:35:32	1.2
> +++ XMLAttributesImpl.java	2001/09/07 04:51:18
> @@ -200,10 +200,12 @@
>       * @param attrIndex The attribute index.
>       */
>      public void removeAttributeAt(int attrIndex) {
> -        if (attrIndex < fLength - 1) {
> -            System.arraycopy(fAttributes, attrIndex
> + 1, fAttributes, attrIndex, fLength - attrIndex -
> 1);
> +	fLength--;
> +        if (attrIndex < fLength) {
> +	    Attribute old = fAttributes[attrIndex];
> +            System.arraycopy(fAttributes, attrIndex
> + 1, fAttributes, attrIndex, fLength - attrIndex);
> +	    fAttributes[fLength] = old;
>          }
> -        fLength--;
>      } // removeAttributeAt(int)
>  
>      /**
> 
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
xerces-j-dev-help@xml.apache.org


__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org