commit-classpath
[Top][All Lists]
Advanced

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

[commit-cp] FYI: Segment.last() - small fix


From: David Gilbert
Subject: [commit-cp] FYI: Segment.last() - small fix
Date: Tue, 25 Jul 2006 14:10:40 +0100
User-agent: Mozilla Thunderbird 1.0.8 (X11/20060502)

This patch (committed) fixes a bug in the last() method, picked up by the Intel 
tests:

2006-07-25  David Gilbert  <address@hidden>

        * javax/swing/text/Segment.java
        (last): Update current index before returning DONE for zero count.

Regards,

Dave
Index: javax/swing/text/Segment.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/text/Segment.java,v
retrieving revision 1.12
diff -u -r1.12 Segment.java
--- javax/swing/text/Segment.java       2 Apr 2006 21:16:03 -0000       1.12
+++ javax/swing/text/Segment.java       25 Jul 2006 13:02:59 -0000
@@ -165,8 +165,9 @@
 
   /**
    * Sets the current index to point to the last character in the segment and 
-   * returns that character.  If the segment contains zero characters, this 
-   * method returns address@hidden #DONE}.
+   * returns that character.  If the segment contains zero characters, the 
+   * current index is set to address@hidden #getEndIndex()} and this method 
returns 
+   * address@hidden #DONE}.
    * 
    * @return The last character in the segment, or address@hidden #DONE} if 
the 
    *         segment contains zero characters.
@@ -174,7 +175,10 @@
   public char last()
   {
     if (count == 0)
-      return DONE;
+      {
+        current = getEndIndex();
+        return DONE;
+      }
     
     current = getEndIndex() - 1;
     return array[current];

reply via email to

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