This makes the harmony tests for GapContent all pass. It makes one assert less strict. AFAICS this is ok.

2006-08-27  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/text/GapContent.java
        (Mark.getOffset): Made assert less strict, include boundary.
        (search): Made package private to avoid accessor method.

/ROman
Index: javax/swing/text/GapContent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/GapContent.java,v
retrieving revision 1.56
diff -u -1 -2 -r1.56 GapContent.java
--- javax/swing/text/GapContent.java	11 Aug 2006 11:16:13 -0000	1.56
+++ javax/swing/text/GapContent.java	28 Aug 2006 12:24:05 -0000
@@ -156,25 +156,25 @@
       mark = offset;
       if (mark >= gapStart && mark != 0)
         mark += (gapEnd - gapStart);
     }
 
     /**
      * Returns the offset of the mark.
      *
      * @return the offset of the mark
      */
     int getOffset()
     {
-      assert mark == 0 || mark < gapStart || mark >= gapEnd :
+      assert mark == 0 || mark <= gapStart || mark >= gapEnd :
              "Invalid mark: " + mark + ", gapStart: " + gapStart
              + ", gapEnd: " + gapEnd;
 
       int res = mark;
       if (mark >= gapEnd)
         res -= (gapEnd - gapStart);
       return res;
     }
 
     /**
      * Implementation of Comparable.
      */
@@ -1004,25 +1004,25 @@
    * Searches the first occurance of object <code>o</code> in list
    * <code>l</code>. This performs a binary search by calling
    * [EMAIL PROTECTED] Collections#binarySearch(List, Object)} and when an object has been
    * found, it searches backwards to the first occurance of that object in the
    * list. The meaning of the return value is the same as in
    * <code>Collections.binarySearch()</code>.
    *
    * @param l the list to search through
    * @param o the object to be searched
    *
    * @return the index of the first occurance of o in l, or -i + 1 if not found
    */
-  private int search(List l, Object o)
+  int search(List l, Object o)
   {
     int i = Collections.binarySearch(l, o);
     while (i > 0)
       {
         Object o2 = l.get(i - 1);
         if (o2.equals(o))
           i--;
         else
           break;
       }
     return i;
   }

Reply via email to