commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: java.text.AttributedStringIterator


From: Guilhem Lavaux
Subject: FYI: java.text.AttributedStringIterator
Date: Sat, 28 Feb 2004 15:20:07 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007

Hi,

Here is an obvious fix concerning AttributedStringIterator. end_index represents the first character which is not concerned by the attribute and so we must have a strict inequality.

ChangeLog:

2004-02-28    Guilhem Lavaux <address@hidden>

    * java/text/AttributedStringIterator.java
    (getAllAttributesKey): Return only keys concerned
    by the current iterator.
    (getAttributes): Use strict inequality for
    end_index.


Index: java/text/AttributedStringIterator.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/AttributedStringIterator.java,v
retrieving revision 1.4
diff -u -b -B -r1.4 AttributedStringIterator.java
--- java/text/AttributedStringIterator.java     22 Jan 2002 22:27:01 -0000      
1.4
+++ java/text/AttributedStringIterator.java     28 Feb 2004 11:14:42 -0000
@@ -181,6 +181,10 @@
 
   for (int i = 0; i < attribs.length; i++)
     {
+      if (attribs[i].begin_index > getEndIndex()
+         || attribs[i].end_index <= getBeginIndex())
+       continue;
+
       Set key_set = attribs[i].attribs.keySet();
       Iterator iter = key_set.iterator();
       while (iter.hasNext())
@@ -327,7 +331,7 @@
           // Check for attribute match and range match
           if (obj.equals(attrib))
             if ((ci.getIndex() >= attribs[i].begin_index) &&
-                (ci.getIndex() <= attribs[i].end_index))
+                (ci.getIndex() < attribs[i].end_index))
               return(attribs[i].attribs.get(obj));
         }
     }
@@ -351,7 +355,7 @@
   for (int i = 0; i < attribs.length; i++)
     {
        if ((ci.getIndex() >= attribs[i].begin_index) &&
-           (ci.getIndex() <= attribs[i].end_index))
+           (ci.getIndex() < attribs[i].end_index))
          m.putAll(attribs[i].attribs);
     }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]