--- ../openjdkb23/openjdk.old/jdk/src/share/classes/java/nio/Buffer.java	2007-10-30 04:36:08.000000000 -0400
+++ openjdk/jdk/src/share/classes/java/nio/Buffer.java	2007-11-13 13:33:28.000000000 -0500
@@ -234,8 +234,8 @@
         if ((newPosition > limit) || (newPosition < 0))
             throw new IllegalArgumentException();
         position = newPosition;
-        if (mark > position) mark = -1;
-        return this;
+        if (mark > position) clearMark();
+	return this;
     }
 
     /**
@@ -266,8 +266,8 @@
             throw new IllegalArgumentException();
         limit = newLimit;
         if (position > limit) position = limit;
-        if (mark > limit) mark = -1;
-        return this;
+        if (mark > position) clearMark();
+	return this;
     }
 
     /**
@@ -319,8 +319,8 @@
     public final Buffer clear() {
         position = 0;
         limit = capacity;
-        mark = -1;
-        return this;
+        clearMark();
+	return this;
     }
 
     /**
@@ -347,7 +347,7 @@
     public final Buffer flip() {
         limit = position;
         position = 0;
-        mark = -1;
+        clearMark();
         return this;
     }
 
@@ -368,7 +368,7 @@
      */
     public final Buffer rewind() {
         position = 0;
-        mark = -1;
+        clearMark();
         return this;
     }
 
@@ -547,4 +547,8 @@
             throw new IndexOutOfBoundsException();
     }
 
+    final void clearMark() {                            // package-private
+        mark = -1;
+    }
+
 }
