According to the java.text.AttributedCharacterIterator Javadoc:
"The returned indexes are limited to the range of the iterator."
Also, for runLimit it says:
"Returns the index of the first character following the run with respect
to the given attribute containing the current character."
Neither of these conditions were met for the AttributedStringIterator
implementation. This manifested itself as an infinite loop in Apache
Batik. I committed the corresponding Mauve test.
OK to commit?
--
Ziga
2005-06-13 Ziga Mahkovec <[EMAIL PROTECTED]>
* java/text/AttributedStringIterator.java (getRunLimit): Fixed the
range of the returned indexes.
Index: java/text/AttributedStringIterator.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/AttributedStringIterator.java,v
retrieving revision 1.7
diff -u -r1.7 AttributedStringIterator.java
--- java/text/AttributedStringIterator.java 23 Apr 2004 16:03:10 -0000 1.7
+++ java/text/AttributedStringIterator.java 13 Jun 2005 17:53:31 -0000
@@ -1,5 +1,5 @@
/* AttributedStringIterator.java -- Class to iterate over AttributedString
- Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -228,7 +228,7 @@
for (int i = 0; i < attribs.length; ++i)
{
if (pos >= attribs[i].begin_index &&
- pos <= attribs[i].end_index)
+ pos < attribs[i].end_index)
{
Iterator iter = attribute_set.iterator();
while(iter.hasNext())
@@ -242,7 +242,7 @@
if (hit)
return runLimit;
else
- return -1;
+ return ci.getEndIndex();
}
/*************************************************************************/
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches