jdk/src/share/classes/java/nio/Heap-X-Buffer.java
changeset 2593 76032557be03
parent 1634 3871c2046043
--- a/jdk/src/share/classes/java/nio/Heap-X-Buffer.java	Mon Apr 13 18:20:51 2009 -0700
+++ b/jdk/src/share/classes/java/nio/Heap-X-Buffer.java	Wed Apr 15 14:53:34 2009 +0100
@@ -572,10 +572,13 @@
             || (end > length())
             || (start > end))
             throw new IndexOutOfBoundsException();
-        int len = end - start;
+        int pos = position();
         return new HeapCharBuffer$RW$(hb,
-                                      -1, 0, len, len,
-                                      offset + position() + start);
+                                      -1,
+                                      pos + start,
+                                      pos + end,
+                                      capacity(),
+                                      offset);
     }
 
 #end[char]